"Multiple method invocations not allowed" error

I’m getting a strange error in /var/log/ltm. It doesn’t seem to affect anything, but I’m still concerned about the entries.

A pseudo-summary:

when HTTP_REQUEST {

set host “[HTTP::host]”

if { [string first “.” ${host}] < 0 } {

set host “[HTTP::host].domain.com”

HTTP::redirect “http://${host}[HTTP::uri]”

}

( blah, blah, blah )

if { [HTTP::path] starts_with “/foo”} {

pool portal

}

else {

HTTP::redirect “http://${host}/foo/bar/baz”

}

}

The log entries look like:

Nov 22 15:48:19 tmm tmm[662]: 01220001:3: TCL error: Rule gwiz-qa - Operation not supported. Multiple method invocations not allowed (line 1) invoked from within “HTTP::redirect “http://${host}/foo/bar/baz””

Nov 22 15:48:19 tmm tmm[662]: 01220001:3: TCL error: Rule gwiz-qa - Operation not supported. Multiple method invocations not allowed (line 49) invoked from within “HTTP::redirect “http://${host}/foo/bar/baz””

First, the cryptic message should really read:

Multiple redirect/respond invocations not allowed (line 1) invoked from within "HTTP::redirect “http://${host}/foo/bar/baz”

What is happening is that your rule is first setting a HTTP::redirect because the host does not contain a “.”. Then, later, you are again invoking a redirect because the path does not start with “/foo”. You can only redirect once for a connection in a given rule. So, you could simply fix this by adding a “return” after the first redirect. Of course, depending on your application, you could also fix it by saving the redirect string off in a variable and then doing the redirect at the end of the rule event if the redirect variable is not empty.

Ah, thanks. I assumed there was an implied return after a redirect, similar to the 4.5 behavior.

On a similar thread, does a “pool” command have an implied return as well, or do I need to explicitly state it?