Author Topic: NS9.0: Content Switching and URL redirect  (Read 2143 times)

Offline asherlm

  • Contributor
  • *
  • Posts: 7
  • Karma: 4
NS9.0: Content Switching and URL redirect
« on: May 15, 2009, 01:31:43 PM »
In NS8.0, I used a responder policy bound to a CS vserver to handle http to https redirects. In 9.0 this particular method does not work as is requires me to have some additional configuration on the CS vserver.

The primary reason I used the responder bound to the CS vserver is so that I would not see a ton of "down" LB vservers that I have defined strictly to redirect http request to the proper https site. I went back to creating a LB http vserver with no service and let the redirect URL be the https site.

Is there a way to make the responder policy work to force a redirect when using a vserver or do I have to bind the same services used on the SSL vservers and just force the responder policy on the LB  vserver?

Thanks!

Offline ZManGT

  • VIP Member
  • ***
  • Posts: 94
  • Karma: 12
Re: NS9.0: Content Switching and URL redirect
« Reply #1 on: May 18, 2009, 03:27:28 AM »
Can you explain why this doesn't work in 9.0, or the additional configuration changes you have to make? I ask because I have the same setup as you but I'm running 8.1. We are looking at 9.0 but this would be a major issue.

Offline asherlm

  • Contributor
  • *
  • Posts: 7
  • Karma: 4
Re: NS9.0: Content Switching and URL redirect
« Reply #2 on: May 18, 2009, 10:55:04 AM »
The generic explanation from my account SE is below:

The CSW policies are now processed first as part of the changes to do the application templates so all the policy types operate consistently. This means if a lb server is selected, then no policies are evaluated

So my understanding of what he has stated is that the CSW requires a backend service to be available in order for the responder rules to be processed. I haven't gone too much further into what he said since I just created my down HTTP LB vserver (no services bound) and have the redirect URL send it to the SSL site.

While that works fine, my problem with it is that now I have a bunch of services that show nice red marks as if there is a problem with the services. 

I've created some HTTP LB vservers and used the same back-end services as its SSL counterpart and applied the responder policy to it. That seems to work quite nicely. My concern was having legitimate services applied to the HTTP vserver and potentially having the ability (if someone screwed up the configuration or via a bug) to have connections coming into the site via http and not https.


Offline ZManGT

  • VIP Member
  • ***
  • Posts: 94
  • Karma: 12
Re: NS9.0: Content Switching and URL redirect
« Reply #3 on: May 18, 2009, 10:57:56 AM »
I agree with you completely. Having a service always show as down is not a good solution, especially if you try to monitor SNMP traps from the netscaler as it always sees those sites as down and will generate alerts.

The other problem like you said is if for some reason a policy gets remove you now have an unencrypted SSL session.

Offline ZManGT

  • VIP Member
  • ***
  • Posts: 94
  • Karma: 12
Re: NS9.0: Content Switching and URL redirect
« Reply #4 on: May 18, 2009, 11:22:08 AM »
Wouldn't you know it that as soon as I post a response I think of an idea that *might* work. What if you just created a generic LB VServer bound to nothing with no IP / port and pointed all your CS Servers to it. That way even if you did make a policy mistake there is nothing for the client to connect to.

Might work?

Offline asherlm

  • Contributor
  • *
  • Posts: 7
  • Karma: 4
Re: NS9.0: Content Switching and URL redirect
« Reply #5 on: May 18, 2009, 12:55:53 PM »
I believe I tried that the other day in some other testing some other options. I'm not a netscaler guru, so I might have been approaching it incorrectly, but I was unable to make it work. That's not to say that it doesn't work, but I will probably go back and try some more testing on those lines sometime this week.

Offline Marco Schirrmeister

  • Hero Member
  • *****
  • Posts: 101
  • Karma: 14
Re: NS9.0: Content Switching and URL redirect
« Reply #6 on: June 02, 2009, 07:00:57 AM »
asherlm,

I think if you create a policy that is always true for example, then you don't need to worry about that some requests come in through http, because the policy is always triggered.
If you use TRUE in the expression for a responder policy, you probably have to create a own vservers for each site where you bind that policy.

To avoid config issues that you also mentioned, I would recommend you create one or multiple dummy vservers with a dummy service.
Nobody needs to touch that dummy vserver to the the risk for loosing some configs should be less.

ZManGT,
you mentioned to create a generic vserver with with no IP/Port. What do you mean with that?
As far as I know you need to specify an IP address when you create a vserver.

I don't know the behavior in version 8.1. But since version 9.0 you can't create any more a vserver or service with the IP 0.0.0.0. They removed that.
If you try that, you get now the following error.
fkcns4> add lb vserver testtest http 0.0.0.0 80
ERROR: Operation not permitted

I noticed this when 9.0 was released and when I tried to convert the configs from all my devices.
After that I changed all my dummy vservers to a the valid IP like the SSL vserver, but with a dummy service that is always UP. (stupid IP with a monitor who does a ping to localhost.


Marco





Offline ZManGT

  • VIP Member
  • ***
  • Posts: 94
  • Karma: 12
Re: NS9.0: Content Switching and URL redirect
« Reply #7 on: June 02, 2009, 07:27:13 AM »
Wow that's another reason not to upgrade to 9.0 for me.

Currently we have many services in the 8.1 code that have no IP or port listed. You just set the option directlyaccessible to no. It sounds like if I upgrade to this system ALOT of our stuff will break. Not a good move by Citrix.

Offline asherlm

  • Contributor
  • *
  • Posts: 7
  • Karma: 4
Re: NS9.0: Content Switching and URL redirect
« Reply #8 on: June 02, 2009, 07:53:00 AM »
mschirrmeister - Thanks for the input. I was close to getting that working, but I couldn't think of an easy way to keep a fake service up. Pinging the localhost never even came to mind.  Doh!

Here's something similar to what I ended up using on our device.
(Edited to put in the missing cs policy 'testing')

Code: [Select]
! Create http to https redirect for any request coming in on port 80.
!
add responder action RedirectHttpToHttps redirect "\"https://\" + http.REQ.HEADER(\"Host\").HTTP_URL_SAFE" -bypassSafetyCheck NO
add responder policy RedirectHttpToHttps "client.tcp.DSTPORT.EQ(80)" RedirectHttpToHttps RESET
!
! Bind as a policy label to use with more than one vserver
!
add responder policylabel "http-to-https-redirects"
bind responder policylabel "http-to-https-redirects" RedirectHttpToHttps 100 END
!
! Create "dummy" vservers and monitor that lead to nowhere.
!
add service dummyservice1 192.0.2.1 HTTP 80 -gslb NONE -maxClient 0 -maxReq 0 -cip ENABLED "X-Forwarded-For" -usip NO -sp OFF -cltTimeout 180 -svrTimeout 360 -CKA YES -TCPB NO -CMP YES
add lb vserver dummyvserver1 HTTP 192.168.0.1 80 -persistenceType NONE -cltTimeout 180
bind lb vserver dummyvserver1 dummyservice1
add lb monitor dummymonitor1 PING -LRTM ENABLED -destIP 127.0.0.1
bind lb monitor dummymonitor1 dummyservice1
!
! Create CS vserver and add Policy Label AND dummy vserver 

add cs vserver "dummy-redirect" HTTP 10.1.1.1 80 -cltTimeout 180
add cs policy "testing" -rule http.REQ.IS_VALID
bind cs vserver "dummy-redirect" -policyName "NOPOLICY-RESPONDER" -priority 110 -gotoPriorityExpression END -invoke policylabel "http-to-https-redirects"
bind cs vserver "dummy-redirect" dummyvserver1 -policyName testing -priority 100
« Last Edit: June 09, 2009, 02:21:49 PM by asherlm »

Offline Marco Schirrmeister

  • Hero Member
  • *****
  • Posts: 101
  • Karma: 14
Re: NS9.0: Content Switching and URL redirect
« Reply #9 on: June 02, 2009, 08:33:15 AM »
ZManGT,

I have a small correction. In my example you get this error. But this was because I specified the port.
It works if you if you do it in the way that you described. No IP and no Port.

fkcns4> add lb vserver testtest http 0.0.0.0 0
 Done

Here is what is removed in 9.0. You can't add a server with 0.0.0.0 anymore.
fkcns4> add server dummyserver 0.0.0.0
ERROR: Invalid domain name syntax

Here is the answer from Citrix support to my question about a server with the ip 0.0.0.0

--------------
The ability to add a server record on the Netscaler with the IP of 0.0.0.0 has been removed. However, this does not impact any configuration within an upgrade. In the earlier versions of Netscaler a Content Switching virtual server bind to a load balancing virtual required the load balancing virtual server to have a service bound to it. That is the reason why some of our documentations instruct customers to create a dummy server/service/vserver to address this. Also note that pre version 8.0 we did not have the Responder module which was another reason to have this configuration.

But as you can see, this is no longer required since the Content Switching virtual server can now on version 9.0 accept a target load balancing virtual server that does not have a service bound to it.
--------------