Forum Discussion

mnb_63148's avatar
mnb_63148
Icon for Nimbostratus rankNimbostratus
Oct 15, 2013

Operation not supported. Multiple redirect/respond invocations not allowed

I am receiving the following error in the ltm log (private data has been modified).

 

TCL error: redirect_irule - Operation not supported. Multiple redirect/respond invocations not allowed (line 9) invoked from within "HTTP::respond 307 "Location" "https://www.fruit.com[HTTP::uri]"

 

I have seen previous posts on the error, but cannot find a way to perform all of the redirects without multiple response/redirect lines in the irule. The iRule is listed below.

 

when HTTP_REQUEST { set host [HTTP::host] set uri [HTTP::uri]

 

switch -glob [string tolower [HTTP::host]] { "lemons.com" { HTTP::respond 301 "Location" "https://www.fruit.com/links/test?[HTTP::query]" } } if { $host contains "apples.com" and $uri contains "tree" } { HTTP::respond 307 "Location" "http://web.fruit.com/tree.aspx" } else { HTTP::respond 307 "Location" "https://www.fruit.com[HTTP::uri]" } }

 

The goal is to have the redirects in place. Currently, the LTM is intermittently sending resets (RSTs) back to the client for www.lemons.com and lemons.com. Sometimes the browser issues a redirect and other times it doesn't due to the reset.

 

www.lemons.com -> redirect to https://www.fruit.com/links/test?[HTTP::query] lemons.com -> redirect to https://www.fruit.com/links/test?[HTTP::query] www.apples.com -> redirect to https://www.fruit.com apples.com/tree -> redirect to https://www.fruit.com/[HTTP::uri]

 

Thanks.

 

2 Replies

  • The easiest way to handle this is to do a TCP::Close followed by return

     

    As long as that is the only iRule doing redirects, you should stop seeing the warnings in the log.

     

  • Is this logic the same as what you need? would it work better?

    when HTTP_REQUEST { 
        set host [string tolower [HTTP::host]]
        set uri [HTTP::uri]
    
        if {$host equals "lemons.com" } {
            HTTP::respond 301 "Location" "https://www.fruit.com/links/test?[HTTP::query]"
        } elseif { $host contains "apples.com" and $uri contains "tree" } { 
            HTTP::respond 307 "Location" "http://web.fruit.com/tree.aspx" 
        } else { 
            HTTP::respond 307 "Location" "https://www.fruit.com[HTTP::uri]" 
        } 
    }