Jump to content
Welcome to our new Citrix community!

Regex question - pass argument from responder policy to action?

julie xu

Recommended Posts



I have a strange requirement. that is:


I need redirect from https://myweb1.mydomain/image/?docid=1234aBcD to https://myweb2.otherdomain/otherimage/otherdir/?docid=1234aBcD, 


which ?docid=1234aBcD is same between policy/action, also, client give the part of url is changed time by time.


Is this configuration can be achieved in netscaler ? if so, how can I do it?


Any comments will be apprecaited


Thanks in advance







Link to comment
Share on other sites

This can probably be done without the regex operators all together.  Depending on the complexity of the query such as if additional parameters will be present, we can update this.  Also, as a REDIRECT the client makes a request to myweb1.mydomain.com and we will then respond with a redirect to myweb2.otherdomain, and the user will make a new request to this name.  If instead you want a public/private rewrite where the user connects to public FQDN1 and then we change it before passing to the backend to FQDN2, and the user isn't aware of the change, then this will be a rewrite instead or even  a URL transform.  Responder is demo'd below.



Redirect request:  https://myweb1.mydomain/image/?docid=1234aBcD to 




Responder Policy with Redirect action (using regular string comparison operators)

add responder action rs_act_sendto_myweb2 redirect "\"https://myweb2.otherdomain/otherimage/otherdir/?docid=\" + http.REQ.URL.QUERY.VALUE(\"docid\")" -responseStatusCode 302


add responder policy rs_pol_sendto_myweb2 "http.REQ.HOSTNAME.SET_TEXT_MODE(ignorecase).EQ(\"myweb1.mydomain\") && http.REQ.URL.PATH.GET(1).SET_TEXT_MODE(ignorecase).EQ(\"image\") && http.REQ.URL.QUERY.CONTAINS(\"docid\")" rs_act_sendto_myweb2

Bind the responder policy to the vserver that receives the "myweb1.mydomain" requests.


If you have additional query parameters to preserve, then the rule can be adjusted.

Also, the above example only redirects URLS going to myweb1.mydomain.com/image/?docid=<docid>; if you need to redirect anything on old domain with a docid to new domain with docid regardless of originating path, than additional adjustments to policy and action can be made.




  • 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...