Forum Discussion

Joe_Pipitone's avatar
Joe_Pipitone
Icon for Nimbostratus rankNimbostratus
Mar 10, 2010

iRule error in logs

The iRule below is throwing the following error in our logs. Can anyone help?

TCL error: our-rewrite HTTP_REQUEST - Operation not supported. Multiple redirect/respond invocations not allowed line 2 invoked from within HTTP::redirect http://sitename.org[HTTP::uri] default arm line 1 invoked from within switch -glob [HTTP::host] { / { HTTP::redirect http://sitename.org } default { HTTP::redirect http://sitename.org[HTTP::uri]...

Here's the iRule:

  
  when HTTP_REQUEST {   
      if { ([HTTP::host] eq "www.sitename.org") } {   
          switch -glob [HTTP::host] {   
               "/" { HTTP::redirect "http://sitename.org" }   
               default {  HTTP::redirect "http://sitename.org[HTTP::uri]" }  
          }   
      }   
  }  
  

3 Replies

  • Hi Joe,

    Not exactly why this would kick off an error message.

    However, have you tried the following

     
       when HTTP_REQUEST {    
           if { ([HTTP::host] eq "www.sitename.org") } {    
              set blah [HTTP::uri]  
              switch -glob [HTTP::host] {    
                    "/" { HTTP::redirect "http://sitename.org" }    
                    default {  HTTP::redirect "http://sitename.org$blah" }   
               }    
           }    
       }   
     

    Bhattman
  • From what I've read, the error relates to having 2 redirects in the same statement - does this help?
  • Hi Joe,

     

     

    The error indicates there are two blocks of iRule code trying to send an HTTP redirect or response from an iRule. This can be in one iRule or multiple iRules on the same VIP. The iRule you've posted above cannot be the sole cause as it is can only send a single redirect per HTTP request. Do you have another iRule enabled on the VIP which is also sending a redirect?

     

     

    Also, since you're not using any wildcards on the switch cases, you don't need to use the -glob flag.

     

     

    Aaron