Forum Discussion
Prakash_Bhavsar
Nimbostratus
Jun 22, 2006Multiple redirect not allowed
I have BigIP with Version 9.2.2. I have following iRule configured for my web site. I can not get redirect for uri starting with "/returns.jsp". I am getting error saying "Multiple redirect are not su...
Deb_Allen_18
Jun 22, 2006Historic F5 Account
F5 has made some adjustments to default TCL behaviour to allow "else" to occur @ the beginning of a line, but I'd suggest re-arranging the structure of the rule so the "else" statements are on the same line as the "}", to conform w/standard TCL syntax:
when HTTP_REQUEST {
if {[HTTP::host] contains "staging.originalpenguin.com" and [HTTP::uri] contains "/fif="}{
use pool pei_staging_8087_pool
} elseif {[HTTP::uri] contains "user" or [HTTP::uri] contains "checkout" }{
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
if {[HTTP::host] contains "staging.originalpenguin.com" and [HTTP::uri] starts_with "/dialogcentral"}{
use pool pei_staging_1080_pool
} elseif {[HTTP::host] contains "staging.originalpenguin.com" and [HTTP::uri] starts_with "/returns.jsp"}{
HTTP::redirect "http://staging.originalpenguin.com/opg/service/customer_care_returns_exchanges.jsphandling"
}
if {[HTTP::host] contains "staging.originalpenguin.com" and [HTTP::uri] starts_with "/opg"}{
use pool pei_staging_1080_pool
} else {
HTTP::redirect "http://staging.originalpenguin.com/opg/"
}
}Looking closely at the conditions you've created, there are 3 separate "if" statements, and there are indeed 2 redirects if a condition matches in one of the first 2 and you fall out to the "else" in the third.I'd recommend changing the 2nd and 3rd "if"s to "elseif"s, and it is a good practice to add a "return" after each redirect to terminate rule processing for that connection. (Rule processing otherwise continues to evaluate all conditions to the end of each event.):
when HTTP_REQUEST {
if {[HTTP::host] contains "staging.originalpenguin.com" and [HTTP::uri] contains "/fif="}{
use pool pei_staging_8087_pool
} elseif {[HTTP::uri] contains "user" or [HTTP::uri] contains "checkout" }{
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
return
} elseif {[HTTP::host] contains "staging.originalpenguin.com" and [HTTP::uri] starts_with "/dialogcentral"}{
use pool pei_staging_1080_pool
} elseif {[HTTP::host] contains "staging.originalpenguin.com" and [HTTP::uri] starts_with "/returns.jsp"}{
...HTH/deb
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
