Forum Discussion
MattC_58842
Nov 29, 2011Nimbostratus
HTTP redirect ?
Today I have a I-rule that has 1 URL redirect , im trying to figure out how to add multiple lines in this i-rule.
when HTTP_REQUEST {
if { [HTTP::host] contains "eprospectusdirec...
Hi MattC,
You can use a switch statement. Try this:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
"*eprospectusdirect.com" { HTTP::redirect "http://dstoutput.com/product/eprospectusdirect" }
"*dstmailingservices.com" { HTTP::redirect "http://dstoutput.com/product/presort-services" }
"*statementpacks.com" { HTTP::redirect "http://dstoutput.com/statementpacks/index.html" }
default {
pool wdc-docorpws-5000
}
}
}
Just wanted to point out that according to the RFC Standards, the [HTTP::host] value should be case insensitive, but performing a string tolower anyway catches all compliant and non-compliant browsers.
Hope this helps.
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