Forum Discussion
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
- Kevin_Stewart
Employee
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" } } } - Renato
Altostratus
Aren't you looking for the 'event' command?
You can use this to prevent next iRules from executing:
event disable allReference here: https://devcentral.f5.com/wiki/iRules.event.ashx
- Renato
Altostratus
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.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
