Forum Discussion

Sanjay_Bhandari's avatar
Sanjay_Bhandari
Icon for Nimbostratus rankNimbostratus
Oct 10, 2013

Conditional redirection seeing the url ?

Original plan was to have it as follows abc.xyz.com/stage abc.xyz.com/dev abc.xyz.com/

 

The web services folks could not create a page with /dev and /stage

 

when HTTP_REQUEST { Check the requested path with wildcard matching switch -glob [HTTP::path] { "/stage" { /stage URI pool app-stage-pool } "/dev" { /dev URI pool app-dev-pool } default { non-/project URI pool app-prod-pool } }}

 

now

 

I want to have a single vip have 3 dns names

 

abcdev.xyz.com 1.1.1.1 abcstage.xyz.com 1.1.1.1 abc.xyz.com1.1.1.1

 

when HTTP_REQUEST { Check the requested path with wildcard matching switch -glob [HTTP::uri] { "abcstage" { /stage URI pool app-stage-pool } "abcdev" { modelndev URI pool app-dev-pool } default { non-/project URI pool app-prod-pool } }}

 

When I try to access the site with dev or stage it still redirects to the default pool. I read some where to change [HTTP::path] to [HTTP::uri]. Is this correct or I need something [HTTP::???]

 

2 Replies

  • Chris_Akker_129's avatar
    Chris_Akker_129
    Historic F5 Account

    Hi Sanjay, you need to switch on the HTTP HOST name, not the URI. The Host is the fqdn, the URI is the path starting with the first forward slash / (after the host.domain.com:port).

     

    Something like:

     

    switch

     

    HTTP::host=abc.xyz.com

     

    Pool prod-pool

     

    HTTP::host=abcdev.xyz.com

     

    Pool dev-pool

     

    HTTP::host=abcstage.xyz.com

     

    Pool stage-pool

     

    Looks for examples on "Universal HTTP host redirect" in CodeShare.

     

    -Chris.

     

  • Hi Chris,

     

    Thank you for the answer. I tried exactly what you have suggested and it worked just fine.

     

    Sanjay