Forum Discussion

Ken_Cottrell's avatar
Ken_Cottrell
Icon for Nimbostratus rankNimbostratus
May 17, 2011

Multiple redirect/respond directives not allowed in logs

The rule is supposed to only fire on root "/" requests. It is supposed to not fire on user agent string matches defined in a search engine class list, but it should fire on user agent string matches defined in a mobile calls list.

 

If it is not a root request, it should fall through to the default pool for the VS.

 

 

As a side note, mobile.site.com is a CNAME for www.site.com

 

 

Does anyone see the problem with this rule?

 

 

when HTTP_REQUEST {

 

if { ([HTTP::uri] equals "/") } {

 

if {not([class match [string tolower [HTTP::header User-Agent]] contains user_agent_search_engine_list])} {

 

if {([class match [string tolower [HTTP::header User-Agent]] contains user_agent_mobile_list]) } {

 

HTTP::redirect http://mobile.site.com/mobile/index.jsp

 

}

 

}

 

 

}

 

else {

 

pool www.site.com_80 }

 

}

 

5 Replies

  • Hi Ken,

     

     

    You only have one redirect in that iRule. Do you have another iRule on the virtual server? Or do you have an HTTP class which does a redirect? Can you post an anoymized copy of the 'b virtual VS_NAME list' output?

     

     

    Thanks, Aaron
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Also, the specific log entry that you're seeing would be helpful. As Aaron said, that rule alone wouldn't cause a multi-redirect error.

     

     

    Thanks,

     

    Colin
  • Yes there is another iRule prior to the mobile site iRule which redirects short name to full name shown below:

     

     

    when HTTP_REQUEST {

     

    switch [string tolower [HTTP::host]] {

     

    site.com {

     

    HTTP::respond 301 Location "http://www.site.com[HTTP::uri]"

     

    }

     

    site2.com {

     

    HTTP::respond 301 Location "http://www.site2.com[HTTP::uri]"

     

    }

     

    }

     

    }

     

     

    This is the most recent log entry for this issue:

     

     

    Tue May 17 04:25:41 CDT 2011 err local/tmm tmm[4712] 01220001 TCL error: redirect-mobile-site - Operation not supported. Multiple redirect/respond invocations not allowed (line 4) invoked from within "HTTP::redirect http://mobile.site.com/mobile/index.jsp "

     

     

    Thank you both for the quick response.

     

  • A runtime error like that is expected whenever more than one redirect is attempted on a single HTTP request.

     

     

    I would either combine the two iRules or set a variable in one iRule that is read by the second iRule to ensure only one iRule attempts to send a redirect. Or you could get a little fancier and use this type of logic:

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/detect_prior_http_redirect_or_respond.html

     

     

    Aaron