Forum Discussion

trx_94323's avatar
trx_94323
Icon for Nimbostratus rankNimbostratus
Apr 30, 2013

operation not supported irule error

Hello Community,

 

I have this issue when having a 301 redirect, I get this error below:

 

TCL error: /Common/portal_url_erp_masking_v4_TRX_PROD - Operation not supported. Multiple redirect/respond invocations not allowed (line 292) invoked from within "HTTP::respond 301 Location "http://$host/erp/""

 

One, should I be worried about this error and two, how do I get rid of it?

 

Current IRules that causes this error:

 

.......

 

elseif { ([string tolower $uri] starts_with "/portal/system") or ([string tolower $uri] starts_with "/portal/console") or

 

([string tolower $uri] equals "/") } {

 

 

redirect to erp homepage user is trying to get to the admin console

 

 

HTTP::respond 301 Location "http://$host/erp/"

 

 

return

 

 

}

 

...

 

 

Thanks in advance.

 

 

TRX

 

9 Replies

  • Looks like you have a very long iRule in place (and possibly other rules assigned to the VS?). I'd suggest you check for any earlier (or later) redirect or respond commands that might match a particular connection more than once. Rather than use 'return' check the logic and flow of the rule to ensure there will only be one match (with no return commands used).

     

    Happy to help if you are prepared to post the entire rule (suitably redacted).

     

  • it seems okay to me. by the way, you may consider replacing some switch and if with class command and data group.

     

     

    class

     

    https://devcentral.f5.com/wiki/iRules.class.ashx
  • It's an anomalous behavior, but you cannot have multiple redirect/respond invocations in a single event. There may be multiple conditions that are proving true. I would suggest two solutions:

     

     

    1. As Nitass stated, dumping all of those URIs and URI patterns into a datagroup or two will make your code WAY easier to read and manage.

     

     

    2. Set a variable at the true conditions, instead of the HTTP::respond, and have a single HTTP::respond at the end that uses the variable.

     

  • Thanks I will give it a try and see if the errors go away. I''ll keep you guys posted.

     

  • Just checking in on this. Any thoughts community?

     

    Thanks!

     

  • The idea for option 2 was to set a variable and then act on it once. So for example:

    when HTTP_REQUEST {
        if { some condition } {
            set redir "/foo"
        } elseif { some other condition } {
            set redir "/bar"
        }
        ...
        if { [info exists redir] } {
            HTTP::respond 301 $redir
        }
    }
    
  • Thanks. I'm have to revisit this later and let you know my results.

     

  • Question.. if I have multiple Irules and use the "return" at the end of each http request event will that cause problems? Should I even be using the "return" key?

     

    Thnaks.