Forum Discussion

Stuart_Feather1's avatar
Stuart_Feather1
Icon for Nimbostratus rankNimbostratus
Sep 23, 2014
Solved

iRule error - Multiple redirect/respond invocations not allowed

I have an existing iRule that redirects any requests to our root site (http://abc.com) to be redirected to www.abc.com. Simplified example of the iRule below.   when HTTP_REQUEST { if { ([HTTP...
  • shaggy_121467's avatar
    Sep 23, 2014

    Since the logic is somewhat related (redirect logic), why not merge the two iRules into something like:

    when HTTP_REQUEST {
        switch [HTTP::uri] {
        "/Page1.php" {
         HTTP::respond 301 Location "http://www.abc.com/Page1.aspx" 
         } 
    
         "/Page2.php" { 
         HTTP::respond 301 Location "http://www.abc.com/Page2.aspx" 
         } 
    
         default { 
          if { ([HTTP::host] equals "abc.com" ) } {
             HTTP::respond 301 Location "http://www.abc.com[HTTP::uri]" 
            } 
         }
        }
    }