Forum Discussion
Ryan_Chin_80280
Nimbostratus
Aug 19, 2005Multiple redirect/respond invocations not allowed
Hi Guys,
Need some help on a iRule i wrote, would appreciate if anyone can shed some light on what is wrong with it.
The iRule below is trying to do 3 things.
1) redirect all...
Erick_Hammersm1
Aug 19, 2005Historic F5 Account
Since the rule will always evaluate each conditional, a single request could result in multiple HTTP::redirect statements. For example, a request for http://www.abc.com/ would match both the TCP::local_port != 443 and the HTTP::uri == "/" conditions. This rule will not encounter this problem:
when HTTP_REQUEST {
if {[TCP::local_port] != "443"} {
HTTP::redirect https://[HTTP::host]/exchange
} else {
set my_uri [string tolower [HTTP::uri]]
if { $my_uri starts_with "/exchange/customerservice" } {
HTTP::redirect https://[HTTP::host]/exchange
} elseif { $my_uri eq "/" } {
HTTP::redirect https://[HTTP::host][HTTP::uri]/exchange
}
}
}Of course, I am making some assumptions about exactly what behavior you are looking for, but you should be able to rearrange this framework to achieve whatever logic you need.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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