Forum Discussion
spankme_86674
Nimbostratus
Nov 23, 2012Optimizing redirects to avoid TCL error "Multiple redirect/respond invocations"
Hi everyone,
I would like to ask for help in finding the reason why following rule (stripped out of confidential data) is causing the error of:
Fri Nov 23 04:06:03 GMT 2012 err ...
What_Lies_Bene1
Cirrostratus
Nov 23, 2012If those other rules contain redirect or respond commands, that'll be the issue. You're best bet is to combine any of the rules that contain redirect/respond commands. I'd also carefully check your rule logic to ensure a request can't match two criterea by using elseif and/or return statements. Here's an example (a bit overkill) using your rule above;
when HTTP_REQUEST {
log local0. "Found [HTTP::host]"
if { [HTTP::path] equals "/" or [HTTP::path] equals "/vod" } {
HTTP::path "/vod/"
}
set rdr_target [class match -value [HTTP::uri] equals some_uri_redirects]
if { $rdr_target ne "" } {
HTTP::respond 301 Location $rdr_target
log local0. "Found match with value = $rdr_target"
return
}
elseif { [HTTP::path] starts_with "/watch" } {
HTTP::respond 301 Location "http://blabla/vod/page/default/home.do"
return
}
elseif { [HTTP::host] equals "blabla" } {
log local0. "Found [HTTP::host]"
set rdr_target [class match -value [HTTP::uri] equals someother_uri_redirects]
if { $rdr_target ne "" } {
HTTP::respond 301 Location $rdr_target
log local0. "Found match with value = $rdr_target for blabla"
return
}
else {
if { [TCP::local_port] equals "80" } {
HTTP::respond 301 Location "http://blabla[HTTP::uri]"
return
} else {
HTTP::redirect "https://blabla[HTTP::uri]"
}
}
}
}
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
