Forum Discussion
Optimizing 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 local/tmm3 tmm3[6833] 01220001 TCL error: goRedirects - Operation not supported. Multiple redirect/respond invocations not allowed (line 21) invoked from within "HTTP::respond 301 Location $rdr_target"
Fri Nov 23 04:06:04 GMT 2012 err local/tmm3 tmm3[6833] 01220001 TCL error: goRedirects - Operation not supported. Multiple redirect/respond invocations not allowed (line 17) invoked from within "HTTP::respond 301 Location "http://blabla/vod/page/default/home.do""
Fri Nov 23 04:06:04 GMT 2012 err local/tmm tmm[6830] 01220001 TCL error: goRedirects - Operation not supported. Multiple redirect/respond invocations not allowed (line 11) invoked from within "HTTP::respond 301 Location $rdr_target"
Fri Nov 23 04:07:46 GMT 2012 err local/tmm1 tmm1[6831] 01220001 TCL error: goRedirects - Operation not supported. Multiple redirect/respond invocations not allowed (line 21) invoked from within "HTTP::respond 301 Location $rdr_target"
Fri Nov 23 04:08:23 GMT 2012 err local/tmm3 tmm3[6833] 01220001 TCL error: goRedirects - Operation not supported. Multiple redirect/respond invocations not allowed (line 11) invoked from within "HTTP::respond 301 Location "http://blabla[HTTP::uri]""
The rule:
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"
}
if { [HTTP::path] starts_with "/watch" } {
HTTP::respond 301 Location "http://blabla/vod/page/default/home.do"
}
if { [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"
} else {
if { [TCP::local_port] equals "80" } {
HTTP::respond 301 Location "http://blabla[HTTP::uri]"
} else {
HTTP::redirect "https://blabla[HTTP::uri]"
}
}
}
}
Thanks in advance!
S.
19 Replies
- Michael_Yates
Nimbostratus
How many other iRules do you have applied to the Virtual Server that is throwing this error?
The most common cause of this problem is that multiple Redirect iRules are applied to the same Virtual Server. - spankme_86674
Nimbostratus
There is 6 iRules assigned total, so 5 other iRules are assigned to this vserver.
- spankme_86674
Nimbostratus
Also, I've just noticed that this rule is attached to more than one virtual server (unlike as I thought). Is there a way to determine on which virtual server its causing these issues? I cant read it from logs. - Michael_Yates
Nimbostratus
You might have some conflicting logic between them.
An easy way to prevent this would be to use return statements after each one of your redirects that will cause the iRule to stop processing any other logic in that event and prevent any logic conflicts.
Something like this: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 } if { [HTTP::path] starts_with "/watch" } { HTTP::respond 301 Location "http://blabla/vod/page/default/home.do" return } if { [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 { HTTP::respond 301 Location "http://blabla[HTTP::uri]" } } }
If you are still getting this error after you have return statements look for logic conflicts in the other iRules that are applied to the Virtual Server. - What_Lies_Bene1
Cirrostratus
If 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]" } } } } - Michael_Yates
Nimbostratus
The fastest way to find out which Virtual Server is running the iRule would be to log the [HTTP::host] value or the IP::local_addr that will log the IP Address of the Virtual Server. - spankme_86674
Nimbostratus
Thanks for all your inputs guys, it's been very valuable! I am now reading and proposing changes to ours iRules, as it turned out that we've redirects all over the place. I have a question about the 'return' statement you're proposing to use tho - will it stop processing all iRules once its matched to something and sees the return, or will it stop processing this particular iRule and will move to the next one? Im trying to understand how dangerous it is to use it just like that, without rewriting all iRules to match exactly and only what they should - what I think is the root cause of the problem. - What_Lies_Bene1
Cirrostratus
The return command will stop processing of the current event in the current iRule only.
https://devcentral.f5.com/wiki/iRules.return.ashx - spankme_86674
Nimbostratus
While rewriting the iRule, I've noticed that there is one if statement that isnt (for reasons unknown to me) located in data group list:
if { [HTTP::path] starts_with "/watch" } {
HTTP::respond 301 Location "http://blabla/vod/page/default/home.do"
}
Is there any reason why it couldnt be there, to clear out the rule? For example, this starts_with makes it sort of regexp, would that also work as a data group list entry, or not? - What_Lies_Bene1
Cirrostratus
I don't see any reason why you couldn't put this in the Data Group, you'd just need to make sure nothing else starts with the same text.
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
