WilliamC
Feb 24, 2020Nimbostratus
URL Host rewrite then pool selection based on URI
I have a iRule that directs traffic to specific pools based on the URI.
I am now needing to rewrite the original host part of the URL then allow for the switch statement to direct to the correct pool
I am attempting the following code but it does not seem to rewrite the host when going to pool A.
when in the browser and going to bob.com/tobee, the URL still shows as bob.com/tobee.
If I go to bob.com/nottobee then the URL changes to www.bob.com/nottobee
when HTTP_REQUEST {
if { [HTTP::host] equals "bob.com" } {
HTTP::header replace "Host" "www.bob.com"
}
switch -glob -- [string tolower [HTTP:uri]] {
"/tobee*" {
pool pool_A
}
"nottobee" {
pool pool_B
}
}
}