For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

pawel_01_133441's avatar
pawel_01_133441
Icon for Nimbostratus rankNimbostratus
Jul 13, 2015

Disable all policies after iRule execution - Multiple redirect/respond invocations not allowed

Hi, I would like to prepare sorry page in iRule. I want to display sorry page only for IP address from internet. Below you can find iRule prepared so far:

when HTTP_REQUEST {
    if { not ([class match [IP::client_addr] equals LOCAL_NET]) } {
       HTTP::respond 200 content { 
         Service is not working.
       } Cache-Control No-Cache Pragma No-Cache
  }
}

Problem is that in polices I got some redirect statements, and when IP address is not in IP data group I'm receiving "Multiple redirect/respond invocations not allowed".

Is there some kind of possibility to stop processing Polices after condition from iRule?

3 Replies

  • I believe policies happen before iRules, so the easiest solution would probably be to put everything in an iRule and not use the policies.

    when HTTP_REQUEST {
        if { not ( [class match [IP::client_addr] equals LOCAL_NET] ) } {
            HTTP::respond 200 content "Service is not working'" Cache-Control "No-Cache" Pragma "No-Cache"
        } else {
            if { [string tolower [HTTP::uri]] equals "/foo" } {
                HTTP::redirect "/bar"
            }
        }
    }
    
  • You could try adding a policy on top to redirect the external users to a local page implemented using iFiles. It seems like a good option, I've done this in past for a customer who was trying to implement error messages using complex HTML pages with images and css files. Reference: https://devcentral.f5.com/wiki/iRules.iFile.ashx

     

    Another option to consider is to add an exception condition in your redirect policies for the external users, leaving then the respond event free to be thrown by iRule.