VictorC
Nimbostratus
Mar 15, 2012Trying to use iRule to switch pools
Hi all,
I'm running LTM 10.2.2 and not sure if this is a bug or just a known limitation. I have two virtual servers, each with an iRule to redirect based on the incoming HTTP host request. This is done to save IP addresses. There's a lot more pools, but I have shortened the code to make it look simple here.
This works:
virtual myweb_443 {
destination 192.168.1.100:https
ip protocol tcp
rules ext
persist cookie
profiles {
http_ssl {}
tcp {}
mysslcert.example.com {
clientside
}
}
}
rule ext {
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"alias1.example.com" {
pool alias1-external
}
"alias2.example.com" {
pool alias2-external
}
default {
discard
}
}
}
}
However this doesn't:
virtual myweb_7777 {
destination 192.168.1.100:cbt I put 7777 but BIGIP translates it to cbt
ip protocol tcp
rules int
persist cookie
profiles {
http {}
tcp {}
}
}
rule int {
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"alias1.example.com" {
pool alias1-internal
}
"alias2.example.com" {
pool alias2-internal
}
default {
discard
}
}
}
}
I have to add :7777 to the iRule specifically to make this work but I don't understand why I need to. I didn't think the port is included in the HTTP::host value.
rule int {
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"alias1.example.com:7777" {
pool alias1-internal
}
"alias2.example.com:7777" {
pool alias2-internal
}
default {
discard
}
}
}
}
Can someone confirm? Thanks.