Jump to content
Welcome to our new Citrix community!

Need some help - Forward all requests with exception to one situation

Gary Frye

Recommended Posts

Looking for some assistance if anyone is willing to help, I think I have met with my limit of knowledge of Responder and Rewrite policies.


The Situation:
All requests from one host needs to be forwarded to another, with exception to one URL path that will include a variable component where we need to forward that URL path on to the destination host name.


https://www.something.com  forwards to https://cloud.somethingelse.com


https://www.something.com/anything  forwards to https://cloud.somethingelse.com


https://www.something.com/browse/itsm-1234  forwards to https://cloud.somethingelse.com/browse/itsm-1234


itsm-xxxx is the variable component as it would be different for every request.  Meaning anything after /browse/ needs to be captures and passed on with /browse if that makes sense. Could be itsm-2345 or relm-5432

What I have working so far:
Cloud - push anything from the old hostname to the new hostname:
add responder action Cloud_RedirectToPage_ACT REDIRECT "\"https://cloud.somethingelse.com\""

add responder policy Cloud_RedirectToPage_POL 'HTTP.REQ.HOSTNAME.EQ("https://www.something.com")' Cloud_RedirectToPage_ACT

Cloud - Pass specific URL path to destination  
add responder action Cloud_URL_RedirectToPage_ACT REDIRECT "\"https://cloud.somethingelse.com\""

add responder policy Cloud_URL_RedirectToPage_POL 'HTTP.REQ.URL.PATH.EQ("/browse/ITSM-1234")' Cloud_URL_RedirectToPage_ACT

I have the responder policy "Cloud_URL_RedirectToPage_POL" bound first to the vServer and then "Cloud_RedirectToPage_POL" after.  So if the URL matches "/browse/ITSM-1234" it forwards the URL path to the destination, if not all other requests get forwarded to the root URL of the destination.  

110 - Cloud_URL_RedirectToPage_POL
120 - Cloud_RedirectToPage_POL


So these two policies technically work, but what I do not understand how to do it capture the specific URL requested if the URL contains /browse/ and pass it on since end user requests will be dynamic for anything after /browse 


Any help appreciated, I feel like I am almost there but just getting beyond my skill set.  I am open to it being all in one policy if that somehow works better.

Link to comment
Share on other sites

You can use an action like this, depending on how much you want to hardcode:
"https://cloud.somethingelse.com/browse/" + http.REQ.URL.PATH_and_query.AFTER_STR("/browse/")



add responder action rs_act_demo3 redirect "\"https://cloud.somethingelse.com/browse/\" + http.REQ.URL.PATH_and_query.AFTER_STR(\"/browse/\")" -responseStatusCode 302
add responder policy rs_pol_demo3 "http.REQ.HEADER(\"host\").SET_TEXT_MODE(ignorecase).EQ(\"www.something.com\") && http.REQ.URL.PATH.GET(1).SET_TEXT_MODE(ignorecase).eq(\"browse\")" rs_act_demo3

NOTE: you can also use starts_with("/browse") instead of get(1) as shown above in the policy trigger.


For the complete scenario, you might need to adjust your other two redirects as they are not handling additional path/queries being supplied. But see if this solves your immediate issue with the "/browse" examples.




  • Like 2
Link to comment
Share on other sites

You are my hero ?, that worked perfectly as described.  I can't tell you how much I appreciate it.


I replaced my "Cloud_URL_RedirectToPage_POL" with your code, bound it first and then followed it with "Cloud_RedirectToPage_POL" as listed to cover any other request and force it to the root URL.


110 - Cloud_URL_RedirectToPage_POL
120 - Cloud_RedirectToPage_POL

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