Forum Discussion
VictorC
Mar 15, 2012Nimbostratus
Trying 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.
- nitassEmployeeI didn't think the port is included in the HTTP::host value.i do not think so.
- Michael_YatesNimbostratusHi Victor,
- VictorCNimbostratusThanks for the bigpipe cli command tip.
- Michael_YatesNimbostratusHi Victor,
- VictorCNimbostratusGreat, thanks for the confirmation!
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects