Jump to content
Welcome to our new Citrix community!

Redirect Requests for “www.oursite.com” to “oursite.com” and Change URL


Recommended Posts

I inherited a Netscaler at my company and unfortunately do not know much about it. My company is changing our website URL from "www.oursite.com" to just "oursite.com".  They want to configure the Netscaler so if someone does use “www.oursite.com” it will automatically redirect them to "oursite.com" and change the URL to show “oursite.com”.  I have been trying to write a Responder policy using examples that I found but nothing seems to be working.  Can someone point me in the right direction?

 

Thanks

Link to comment
Share on other sites

Here's a responder example in this thread for similar question that I just updated yesterday:  https://discussions.citrix.com/topic/404141-301-to-redirect-from-one-url-to-another/

Will try to get you a specific example for yours later today, if someone else doesn't get back to you first.

 

The responder policy will redirect initial requests from old to new, BUT you will need to make sure DNS can still resolve the old and new names to the same VIPs and it might affect how your certs need to be issued.

In addition, if any responses from the web servers contain the old names, this will still appear to users but the requests should be redirected. If you need to change the format of URLs in the response being sent to users, then you may also need to consider URL Transforms (under rewrite) for more comprehensive changes. Will try to add more notes later, if the above example doesn't work.

 

Also, feel free to share what you are trying, as it might just need some tweaking to work how you want.

Link to comment
Share on other sites

Had time on a break:

add responder action rs_act_sendto_oursiteNEW redirect "\"https://oursite.com\" + http.REQ.URL.PATH_AND_QUERY.HTTP_URL_SAFE" -responseStatusCode 301
add responder policy rs_pol_sendto_oursiteNEW "http.REQ.HEADER(\"host\").SET_TEXT_MODE(ignorecase).EQ(\"www.oursite.com\")" rs_act_sendto_oursiteNEW
bind lb vserver <lb vserver name> -policyName rs_pol_sendto_oursiteNEW -priority 10 -gotoPriorityExpression END -type REQUEST
 

Quick notes.

- Assumed SSL...some modifications may be needed.  And the cert will need to valid for either name to avoid trust issues.

- Also I used a 301 redirect (but 302 temporary is also possible)

- Note: During testing, you will need to make sure both the original fqdn and new fqdn resolve to the same VIP:  <www.oursite.com> and <oursite.com>.

You might even need a hosts file entry depending on how your dns is set up for testing purposes.

- Don't forget that your browser may cache results and may prevent the responder policy from being hit; so flush browser cache then close/re-open and tune settings in firefox/ie/other to not cache content.  Make sure the vserver and policy are actually being hit.

 

It's possible taht your original policy was trying to look at the FQDN using http.req.url.contains() instead of http.req.hostname or http.req.header("host").  If that's the case, note that http.req.url doesn't usually have access to the host portion of the URL, but the HOST header does.

 

If you want help with your original policy or if this example doesn't work for you, post more information and someone will try to help out.

 

 

 

 

 

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