Forum Discussion
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
- Benjamin_Moore_
Nimbostratus
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? - Cory_50405
Noctilucent
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_
Nimbostratus
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 }
- Cory_50405
Noctilucent
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 .... ...
- Benjamin_Moore_
Nimbostratus
That is exactly what I was missing. Thank you! - Cory_50405
Noctilucent
No problem. Happy policy building.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com