Forum Discussion
How to use an Irule switch to match HTTP::host and HTTP::uri?
It looks like either the HTTP Host may be having the destination TCP port appended on the end of the hostname and so, failing to match the switch tests. It could also be a trailing slash on the end of the URI of app2easypath.
I have optimized your switch call to avoid getting tripped up with trailing HTTP HOST port info and I added an asterisk wildcard to a couple of the tests. If it is just the hostname with trailing port info you can remove the asterisk in the hostname/uri match at the end of the URI.
Also your sequence order of actions was not right. First the HTTP operations need to be done, then you can pool the connection which will essentially stop irule processing so if you want to disable SSL serverside you should probably do that before the pool as well (as shown below)
when HTTP_REQUEST {
switch -glob [string tolower [getfield [HTTP::host] ":" 1][HTTP::uri]] {
"www.liveapp.customer.co.uk/app2easypath_" {
HTTP::path [string map { /app2easypath /realpath } [HTTP::path]]
SSL::disable serverside
pool CUST1-WEB-PROD-APP2-Pool
}
"www.testapp.customer.co.uk/app2easypath_" {
HTTP::path [string map { /app2easypath /realpath } [HTTP::path]]
SSL::disable serverside
pool CUST1-WEB-PROD-APP2-test-Pool
}
default {
HTTP::redirect http://www.google.com
}
}
}
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