Forum Discussion

Benjamin_Moore_'s avatar
Benjamin_Moore_
Icon for Nimbostratus rankNimbostratus
May 07, 2014

URL hostname redirect to pool

We have a request to redirect traffic coming in to the same VIP as such: www.OURCOMPANY.com --> Pool A dev.OURCOMPANY.com --> Pool B mo.OURCOMPANY.com --> Pool C services.OURCOMPANY.com --> Pool D What is the best way to do this?

 

6 Replies

  • Using this: if {[string tolower [HTTP::host]] eq "dev.OURCOMPANY.com"} elseif {[string tolower [HTTP::host]] eq "mo.OURCOMPANY.com"} elseif {[string tolower [HTTP::host]] eq "services.OURCOMPANY.com"} else I could determine what the hostname is, but how do I send it to the different pools?
  • What version of code are you running? If v11.4 or above, you can use local traffic policy to match on the host and direct to a pool accordingly. Otherwise it can be done via iRule.

     

    • Benjamin_Moore_'s avatar
      Benjamin_Moore_
      Icon for Nimbostratus rankNimbostratus
      I see where I can select the host that I want but not a place where I can select the POOL to send the traffic to. Something like in this iRule: Inspect the hostname provided in the HTTP host field and determine which pool to send the traffic to. if {[string tolower [HTTP::host]] eq "dev.OURCOMPANY.com"} { pool COMPANYdev } elseif {[string tolower [HTTP::host]] eq "mo.OURCOMPANY.com"} { pool COMPANYmo } elseif {[string tolower [HTTP::host]] eq "services.OURCOMPANY.com"} { pool COMPANYsvcs } else { pool COMPANYprod }
  • Your local traffic policy would look like this:

     

    Requires: http Controls: forwarding

     

    Then add rules that look like this:

     

    Condition: http-host request host equals dev.ourcompany.com

     

    Action: forward request select pool COMPANYdev .... ...