Author Topic: Redirecting a URI request to a different service group  (Read 2080 times)

Offline osayers

  • Contributor
  • *
  • Posts: 9
  • Karma: 0
Redirecting a URI request to a different service group
« on: September 24, 2009, 11:18:41 AM »
Hi All,
 My client recently switched from BigIP to netscaler ( makes me a newbie!) and I am encountering problems trying to replicate some iRule functionality. Would someone please advise me how I would redirect requests for a certain URI to go to a different service group. In BigIP the logic is like this:


if ( [HTTP::uri] starts with "/someuri") {
     pool  differentpool.thanVIP's.pool
}

Would I have to create a dummy vserver and bind the new servicegroup to that dummy server and then send all requests starting with "someuri" from the main site to that dummy vserver?
Any and all help suggestions will be very much appreciated

Regards,
Osayers
Regards,
Osborn

Offline jmelika

  • Administrator
  • Hero Member
  • *****
  • Posts: 339
  • Karma: 7
Re: Redirecting a URI request to a different service group
« Reply #1 on: September 24, 2009, 12:29:29 PM »
Hey Osborn,

It's fairly simple.  What you're asking for is a standard Content Switching.  It could get a little confusing, but follow me here.

  • Create your Service Groups.  Load Balancing\Service Groups.
  • Create your Virtual Servers. That would be HTTP protocol and leave the IP and port blank.  You will be creating one for each Service Group you created.  You'll need to go and activate the Service Group with each VS under the Service Groups tab
  • Now you should go to Content Switching and define your policies.  Create one policy for each URI.  Yours should be simple enough: REQ.HTTP.URL CONTAINS /someuri
  • Now you create your site's Virtual Server under Content Switching\Virtual Servers.  This is where you define the public IP address the site points to and port 80.  You should then see all the policies you created.  Activate them and under Target select the VS you created in step 2 above

As you can see, Netscaler allows you to activate Filters, Compression Rules, Rewrite policies, etc under the Content Switching VS.

I hope that helps.

Good luck!
JM

Offline osayers

  • Contributor
  • *
  • Posts: 9
  • Karma: 0
Re: Redirecting a URI request to a different service group
« Reply #2 on: September 24, 2009, 12:33:34 PM »
Thanks JM!!!!!
    I will start setting it up right now...Thanks for such a quick reply as well..

Cheers,
Osborn

Offline osayers

  • Contributor
  • *
  • Posts: 9
  • Karma: 0
Re: Redirecting a URI request to a different service group
« Reply #3 on: September 28, 2009, 02:49:27 PM »
Hey JM,
  If I was to expand the iRule to this:

when HTTP_REQUEST {
        if {[HTTP::uri] starts_with "/quoteitoffline"}{
          pool not.themainpool.com     
      } else {
         HTTP::redirect "https://[HTTP::host][HTTP::uri]"
 }
}

I would have to create 2 vservers: one for the "/quoteitoffline"  serviced by the servicegroup to handle that request AND a second vserver that will be serviced by the site's service group and this vserver should listen on port 443 or should the context switching vserver be on port 443?

Thanx in Advance for your help,
-Osborn


Offline jmelika

  • Administrator
  • Hero Member
  • *****
  • Posts: 339
  • Karma: 7
Re: Redirecting a URI request to a different service group
« Reply #4 on: September 29, 2009, 10:42:39 AM »
That is correct.  You would have to create a VS to handle the "default" requests.  In other words, the requests that none of the policies applied to.  Your "else".

Now if you are doing this in HTTPS and not HTTP, you should consider doing SSL Offloading on the Netscaler.  You're letting the Netscaler negotiate the ssl connection, while the traffic between the NS and the servers is done on standard HTTP.  In this case, your lb vservers are set to HTTP and your Content Switch vserver is set to HTTPS.

I hope that helps.