Jump to content
Welcome to our new Citrix community!

Content Switching and responder help.


Stewart Roth

Recommended Posts

I was asked to have a request hit a content switching server to be redirected to an already existing LBVS.  While that seemed pretty straightforward I ran into some issues because of the way they wanted it.  It needed to be like this:
https://myCSserver.com/aaa/bbb/KeepThisPart.asp

and redirect it to

http://myLBVServer.com/ccc/ddd/KeepThisPart.asp

Basically keep the last part of the original URL but everything in the PATH changes.  I did this by using a responder policy on the LBVS to perform the following action

 

"http://myLBVServer.com/ccc/ddd/" + http.req.url.SET_TEXT_MODE(IGNORECASE).path.get_reverse(0)

 

It redirects fine and seem to work fine to me(network guy), but I'm being told that whatever is in the request body is not making it through.  Is a responder policy not the best way to handle this??  I played around with rewrites and transform's but couldn't really get it to work right. Any other ways to handle this appreciated or is this a possible problem not introduced by the Netscaler and i need to kick this back to dev's to look at?

 

VPX running 12.1

 

Thanks!!

Link to comment
Share on other sites

Does the request actually need to be redirected, or can the CSVS internally send traffic to the LBVS (can be done with a content switching policy)? I think you'll run into problems (like you mentioned) if you're trying to actually send redirects from the CSVS back to the client for them to initiate another request to the LBVS.

Link to comment
Share on other sites

I do have a switching policy to send the request to the LBVS.  Sorry I should have made that clear., redirecting was a bit misleading, my bad. That's how I get to it first and then on the LBVS is where i have the responder policy mentioned above.  My CSVS policy expression simply looks for "/aaa/bbb/" and then the policy targets the LBVS.  Thanks for the response.

Link to comment
Share on other sites

If the problem is that you want a request

http://<csfqdn>/aaa/bbb/<stuff> that needs to get changed to http://<lbfqdn>/ccc/ddd/<stuff> post content switching, I think you need a rewrite instead of a responder.

 

Responder policies redirect requests. Meaning the client receives a response to go to new location.  In this case, you don't want your users being told to connect to the LB vserver, unless it is also directly addressable.

 

Rewrite OR URL transform might be better as we change the request the client sends to netscaler is then changed in the NS to server side of the communication.

Client asks for "x" and the NS asks server for "y".

It shoulds like you might need the rewrite policy applied to the vserver after the cs decision is made, but not quite enough information to gurantee this is the correct approach.

 

If you could provide maybe more details about the traffic requests and the results you are trying to achieve (and what content switching is also doing for you) we might have a better answer for how to accomplish what you want. 

 

Link to comment
Share on other sites

The LB server is also directly addressable for other purposes. Right now what happens is when the request hits the CSVS the policy looks for HTTP.REQ.URL.SET_TEXT_MODE(IGNORECASE).CONTAINS("/aaa/bbb/") and if that matches(there are like 6 other policy's on the CSVS) it sends it to the designated target LB server which in this case is "http://<lbfqdn>". 

Then responder policy off that  has the expression HTTP.REQ.URL.SET_TEXT_MODE(IGNORECASE).CONTAINS("/aaa/bbb/") with the action type set to redirect and the expression is "http://<lbfqdn>/ccc/ddd/" + http.req.url.SET_TEXT_MODE(IGNORECASE).path.get_reverse(0)

 

I essentially need to just keep that last piece of the URL path and change the path of the original request from /aaa/bbb to /ccc/ddd on the LBVS.  I really am not sure or privy to what is in the request body of the traffic when they make a POST that i'm being told isn't making it through.

 

I tried to use a transform policy but it just wasn't even being "hit" to do the actual transform.  I will try that or a rewrite until I can get it to work, but thus far haven't had luck

I'm sorry if that''s not enough info.

Thanks in advance.

 

Link to comment
Share on other sites

So during the user request, if we provide a redirect. That transaction stops and the user is being asked to make a new request to a new destination.  This is probably converting their "post" to a "get" or else its just eliminating any of their original path/query elements in the redirect.  And yes redirecting a post will like lose any post body content.

 

So, you might need the responder policies (if still used), to do something like:

redirect to:

http://<lbfqdn>/ccc/ddd/ + http.req.url.set_text_MODE(ignorecase).path.get_reverse(0) + http.req.url.query

 

Though if their original path, was structured as:

/aaa/bbb/<stuff1>/<morestuff>?<query>

Your original expression dependent on path.get_reverse(0) only grabs composes only the last path element and misses any othere path elments and or query parameters:

/ccc/ddd/<morestuff>

 

So we might need to rethink your redirect.

Or instead of "redirecting" the user change this to a rewrite and/or URL transform so the request is rewritten and modified as it goes through so the post body and other elements are not modified.

More detailed examples or an example of the current URL patterns and/or responder policy and/or previous transform might help with creating proper rewrite or transform rules.

 

Or you might need one set of policies for gets separate from posts...depending on how widespread these URL changes are needed. Its hard to say without more info.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...