0

Context: I have little/no experience with Netscaler and I'm just starting to use them. One of the first jobs I've been given to work with it is what I thought would be a simple one. I have to have the URL http://www.example.com/subdomain/foo/bar redirected to http://subdomain.example.com/foo/bar. I'm hoping a Netscaler pro will just bat this one out of the park.

Here's what I have so far:

add rewrite action RW_TEST replace "HTTP.REQ.URL.QUERY.NAME_VALUE(\"www.example.com/subdomain\")" "\"subdomain.example.com\"" -comment "Test redirect"
add rewrite policy RW_POL_TEST "HTTP.REQ.URL.CONTAINS(\"www.example.com/subdomain\")" RW_TEST

The /foo/bar bit should remain untouched as part of the original request and eventual destination - I just want the subdomain bit rewriting. If the above looks good, please suggest that it does or suggest improvements. I hope it's clear.

My understanding is that this then needs binding to a vserver, which seems to be the easier bit!

  • I have never used NetScaler, but the term HTTP.REQ.URL.QUERY.NAME_VALUE looked wrong right away. Looking at the documentation at docs.citrix.com/en-us/netscaler/10-5/ns-appexpert-con-10/… confirmed my suspicion and it only matches the URL query arguments list, that is the string after ? in URL. So this won't work. I think you need to use HTTP.REQ.URL in your action statement. – Tero Kilkanen Sep 30 '16 at 7:13
0

The question whether this is easy to accomplish or not, lies in the question how dynamic your redirects should be. In plain English: how many subdomains do you wish to support for this action?

If it is a limited set, you could use plains URL Transformation policies, which is a form of rewrite specifically available for these kinds of situations.

I can give you another, more dynamic way, but it would involve a lot of extra code. The dynamic way is based on CoreLogic, a framework a colleague of mine and I created for use on Citrix NetScaler. You can read more about it at https://netscalerrocks.com/netscaler/netscaler-core-logic-10-3-changes-enhancements/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.