URL Rewrite and Responder With Citrix NetScaler
URL Rewrite and Responder With Citrix NetScaler
com
JGSPIERS.COM (HTTPS://WWW.JGSPIERS.COM)
Virtual Application and Desktop delivery
You can use the URL Rewrite feature to accomplish tasks such as directing users to the full
StoreFront path if they do not specify it internally. You could also rewrite HTTP requests to
HTTPS or rewrite headers in a TCP packet.
For example:
2. NetScaler rewrites the URL to append /Citrix/StoreWeb/ to the URL which directs users to
Receiver for Web.
To see how to set Receiver for Web as the default web page in IIS see this post
(https://www.jgspiers.com/storefront-default-iis-page-optimizations/).
Using Responder, we can also direct users to di erent websites on the y, or respond with a
maintenance page for example. One of the main di erences between Rewrite and Responder is
that Rewrite can apply to both requests and responses whilst Responder can only apply to
requests reaching the NetScaler.
Rewrite:
Enable the URL Rewrite feature by navigating to Con guration -> System -> Settings ->
Con gure Basic Features.
Note: Rewrite and Responder comes with Standard, Enterprise and Platinum editions of
NetScaler.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 1/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
To create a rewrite action navigate to AppExpert -> Rewrite -> Actions -> Add.
Enter a name.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 2/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Type = REPLACE
Click Create.
Note: If you wanted to rewrite the value of the User-Agent header for example, you could
con gure your Rewrite action as below. You would then create a Rewrite policy which matches
on the User-Agent header value that you would like to replace with the User-Agent header value
below.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 3/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Enter a name.
Expession = HTTP.REQ.URL.EQ(“/”)
Click Create.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 4/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Navigate to Tra c Management -> Load Balancing -> Virtual Servers and edit your existing
Load Balanced StoreFront vServer.
Continue.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 5/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 6/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Back viewing your Rewrite Policy you can see the Hits counter has gone up.
Responder:
You can use Responder to accomplish tasks such as transferring users from one URL to another.
In this example, I have a web site load balanced through NetScaler on protocol HTTP (port 80).
The URL to access the site is http://mywebapp.citrixpro.co.uk/. I want to use a Responder
policy to direct users to a new version of the web site which is available on URL
http://mywebappnew.citrixpro.co.uk/. These web servers are just basic default IIS installs
showing the main IIS splash screen.
To enable Responder navigate to Con guration -> System -> Settings -> Con gure Advanced
Features.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 7/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
To create a Responder action navigate to AppExpert -> Responder -> Actions -> Add.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 8/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Enter a name.
Type = Redirect.
Expression = “http://mywebappnew.citrixpro.co.uk“
Click Create.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 9/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 10/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Enter a name.
Expression = HTTP.REQ.HOSTNAME.EQ(“mywebapp.citrixpro.co.uk”)
Click Create.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 11/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Now let me show you what happens when I browse to http://mywebapp.citrixpro.co.uk/. I hit
the Load Balanced vServer VIP and am then directed to a server which is actually one of my
StoreFront servers.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 12/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Back on the NetScaler, navigate to Tra c Management -> Load Balancing -> Virtual Servers
and edit the web server vServer.
Click Continue.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 13/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Click Done.
If you view the Responder policy you can see it has been hit a couple of times.
Here is an example WireShark trace (taken from a di erent redirect) showing the 302 Found:
Moved Temporarily packet including the new location that NetScaler is directing the client to.
Type = Redirect
Expression: “https://netscalergatewayurl.domain.com”
By default this will perform a standard 302 redirect, meaning the page has moved temporarily.
This ensures the browser does not cache the page. You can change the redirect code to 301 for
example to tell web browsers that this is a permanent move.
Expression = HTTP.REQ.HOSTNAME.CONTAINS(“netscalergatewayurl.domain.com”)
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 15/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Protocol = HTTP
Port = 80
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 16/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Choose Responder under Choose Policy and Request under Choose Type.
Click on Click to select.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 17/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Click the radio button beside the Responder Policy you have just created and click Select.
Click Bind. Now when users type http://netscalergatewayurl.domain.com they will be directed to
the HTTPS URL.
To achieve the same result this time with a Load Balanced vServer instead of a Content
Switching vServer, navigate to Tra c Management -> Virtual Servers -> Add.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 18/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Protocol = HTTP.
Port = 80.
Click OK.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 19/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Click Add.
Protocol = HTTP.
Port = 80.
Click OK.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 20/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Click Done.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 21/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Click Select.
Click Bind.
Click Continue.
Click Done.
As you can see now, the Virtual Server is up. This is a requirement since clients are going to need
to connect to something on port 80 originally before being redirected.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 22/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
The last step is to bind the Responder policy to the Load Balanced vServer.
Once done, client will be redirected to HTTPS and the Responder policy hits counter will
increase.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 23/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
26 COMMENTS
Jackie
June 16, 2016
Hi,
I am facing the issue. I created the rewrite actions and policies. It is showing active
but i don’t see any hits on it. Also it is not resolving to new webpage (where i want to
redirect). Please give your suggestions for the possible cause.
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=50#respond)
George Spiers
June 18, 2016
If you created the Rewrite action, policy and then bound that policy to your
StoreFront LB vServer it should work.
Please feel free to email me screenshots of the Rewrite con guration and I will
try and help.
[email protected] (mailto:[email protected])
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=52#respond)
Andrew Niteesh
August 1, 2016
Hi,
– Andrew
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=67#respond)
George Spiers
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 24/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
August 2, 2016
Hi Andrew
Regards
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?replytocom=69
Raja
August 10, 2016
HI George,
Thanks for the article. I followed it but was getting a “Placeholder” message accessing
the site. However it worked after making the below two corrections –
1. The Expression in Policy rule should be HTTP.REQ.URL.EQ(“/”).
In the article it is mentioned as HTTP.REQ.URL.EQ(/)
2. Under Action, the Expression to Replace with should be =
“/ReceiverforWeb/Address” instead of “/ReceiverforWeb/Address/”
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=73#respond)
George Spiers
August 10, 2016
Hi Raja
Yes you are right, only one picture shows HTTP.REQ.URL.EQ(/), the others rightly
show (“/”) so not sure how that happened :). I have updated the incorrect picture
to indeed show (“/”). Thanks for spotting that.
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=75#respond)
DJ
August 24, 2016
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 25/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Great article George. I have a scenario where after logging out of StoreFront (coming
through NetScaler gateway) I must close my browser and open a new session in
order to log back in. If I just close my browser tab it, I get a smart card login error.
This makes for a bad user experience b/c you have to close all tabs/browsers
(whether IE/Chrome) depending upon which browser you use and log back in. I have
looked into a session cookie invalidation using a rewrite policy. I’ve also looked at a
responder policy to kill/drop the session as well as a tra c policy and can’t seem to
nd a working policy as I am using smart card authentication in my production lab
but not in my other lab environments. Just to add in my production lab I am using
ADFS/SAML and smart card auth. I am also able to successfully invalidate the
NSC_AAAC session cookie but from what I can tell cannot seem to invalidate the
CtxsSmartcardAuthenticated session cookie which what I think is hanging me up. Any
ideas or thoughts you have would be greatly appreciated!
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=90#respond)
George Spiers
August 24, 2016
Hi DJ. If you do not close the browser and try to log on what is the exact error
message are you getting? Is StoreFront load balanced through NetScaler or is
the NetScaler Gateway sending direct to backend StoreFront servers?
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=91#respond)
Vincent Gedye
March 16, 2017
Good post!
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=860#respond)
SK
July 12, 2017
Hi George,
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 26/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
would be the e ect if we bind the responder/rewrite policy to all the Virtual servers
that are con gured on the netscaler.
Can you please shed some light on the impact, We have around 100-200 Virtual
servers on the Netscaler and we do have considerably more tra c going through the
netscaler.
Thanks,
SK
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=1506#respond)
George Spiers
July 13, 2017
Hi SK. It isn’t easy to predict because every customer NetScaler will be di erent
in terms of how many requests are sent to the NetScaler each second. The
positive is that such a Rewrite is not complex and therefore it is more a case of
how many NetScaler will have to perform. I can only advise you test this yourself
by enabling on a handful of Virtual Servers, monitoring the NetScaler resource
consumption before/afterwards and repeating the process for additional Virtual
Servers. Also keep in mind that NetScaler has an “Insert Client IP Address”
option which inserts the Client IP into a new header. This only works for HTTP/S
tra c and can be enabled globally or at a service level. I would recomend this
option if it suits before using Rewrite.
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=1513#respond)
Vikas Dewan
September 20, 2017
Hi George,
I have a scenario, where I need to rewrite the url based upon the web service
response.
If response is true then redirect to old system otherwise new system. Can we
con gure the same in netscaler ? Can netscaler make decision based upon the
service call ?
Thanks,
Vikas
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 27/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=2323#respond)
George Spiers
September 20, 2017
Yes that sounds do-able. So you create a Rewrite policy for Response which
analyses the response from the backend web server, and an action is associated
with the policy which rewrites the URL and sends to client.
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=2331#respond)
Brenton Crosby
October 16, 2017
Hi George, thanks for your post. I’m attempting to redirect from one HTTPS to
another HTTPS. However in the responder policy, it’s saying Expression syntax error
[^HTTPS.REQ., O set 0]
when I attempt to set the expression as
HTTPS.REQ.HOSTNAME.EQ(“myoldwebapp.mysite.com.au”)
in the Responder policy. Do you know how I would go about redirecting a HTTPS site
to another HTTPS site?
It’s currently listed as a VIrtual Server, however I’ll be updating it to just redirect and
would like to achieve this through the Netscaler.
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=2725#respond)
George Spiers
October 16, 2017
Alternatively:
On the old HTTPS Virtual Server, under Protection -> Redirect URL -> enter the
new URL you want users to be redirected to. Then, mark the Virtual Server as
disabled. All requests to HTTPS URL old will be redirected to HTTPS URL new.
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=2738#respond)
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 28/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
roger
August 6, 2018
Excellent post
I have a question though.
I have a rewrite policy that works by looking at speci c text in the browser tab and
changes it from NetScaler AAA to a new name. This doesn’t happen straight away
and is therefore a security risk by advertising the NetScaler AAA. Is there any way of
con guring so that it does not show the AAA and references the new name straight
away.
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=13948#respond)
Ray
December 5, 2018
Is there not a way to do this with a Vserver? So it appears that you have a Vserver
“UP” inorder for the URL redirect to work. Which then means you have to make sure
the backend is always up as well. Which in my opinion defeats the redirect. Is there
another way to get around this?
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=25131#respond)
George Spiers
December 6, 2018
You can have a vServer that is down, for example no services are bound to it.
You can then use the Protection features of that vServer, in particular the
“Redirect URL” or “Backup Virtual Server” options.
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 29/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=25243#respond)
Ray
December 5, 2018
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=25132#respond)
Clinton
January 16, 2019
Hiya, is it possible to use Netscaler to do a 301 redirect from my .co.uk web interface
to the .com address both sites use certi cates. Users currently use the .co.uk address
internally and externally. I’ve enabled MFA on my .com address. I would like to
redirect all external users from the .co.uk to the .com address.
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=30850#respond)
George Spiers
January 23, 2019
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=31452#respond)
ric
February 2, 2019
Hi Geroge,
We are trying to do two things .
1) Is it possible to remove Network Access choice from SSL VPN choice page with
rewrite policy?
What we are trying to do , We just want users to see only Client Less option .
2) if above scenario is not possible then can we do something so user will default to
Client less choice only.
Ric
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 30/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=32709#respond)
George Spiers
February 3, 2019
Hello – Within your Session Pro le uncheck “Client Choices” and set Clientless
Access to ON.
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=32784#respond)
Shekhar
March 14, 2019
Hi George,
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=38162#respond)
George Spiers
March 15, 2019
Reply (https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/?
replytocom=38304#respond)
LEAVE A REPLY
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 31/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Name*
Email*
Website
POST COMMENT
SEARCH SITE
(http://jgspiers.com/eGInnovations)
(http://jgspiers.com/GoliathTechnologies)
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 32/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
CATEGORIES
Enter your email address to subscribe to this blog. You'll receive noti cations by email when a new
post is published.
Email Address
SUBSCRIBE
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 33/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
TOP POSTS
Citrix Fixes and Known Issues – Windows Server 2019 (https://www.jgspiers.com/citrix- xes-
windows-server2019/)
A battle of Synthetic Application Availability Testing: Citrix App Probing vs Goliath Application
Availability Monitor (https://www.jgspiers.com/battle-of-synthetic-application-availability-testing-
citrix-app-probing-vs-goliath-application-availability-monitor/)
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 34/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
Comment on Disaster recovery and high availability of your pro les made easy with FSLogix Cloud
Cache by George Spiers (https://www.jgspiers.com/disaster-recovery-ha-made-easy-with-fslogix-
cloud-cache/#comment-45763) April 24, 2019
FOLLOW ME ON TWITTER
Tweets by @JGSpiers
George Spiers
@JGSpiers
7h
George Spiers
@JGSpiers
17 Apr 2019
George Spiers
@JGSpiers
#Citrix Director does not report all user connection
failures over the last hour in a XenApp &
XenDesktop 7.15 LTSR CU2/CU3 Site. Contact
Citrix for a private fix -
support.citrix.com/article/CTX249…
17 Apr 2019
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 35/36
4/25/2019 URL Rewrite and Responder with Citrix NetScaler – JGSpiers.com
ARCHIVES
Select Month
Copyright © JGSpiers.com
https://www.jgspiers.com/url-rewrite-responder-citrix-netscaler/ 36/36