Forum Discussion
spalande
Nacreous
Jan 08, 2014iRule not effective for existing connections
We have iRule for server maintenance window, where it will allow only GET requests and block all other requests. This works after applyig iRule to all VIPs. But whoever is already login into the webp...
hoolio
Cirrostratus
Jan 08, 2014thibino is correct that iRule changes only take effect on new connections.
You could leave the iRule enabled at all times, but use a data group to store an on|off value. The iRule would use the class command to check the data group key to see if non-GET requests should be blocked.
https://devcentral.f5.com/wiki/iRules.class.ashx
when HTTP_REQUEST {
Check if the maintenance key is set to on in the maint_dg datagroup
if {[class lookup "maintenance" maint_dg] eq "on"}{
Check if this is not a GET request
if {not ([HTTP::method] eq "GET")}{
Send an HTTP response with cache control headers set to not cache the response
HTTP::respond 200 content {Please retry your request later. Maintenance!} Connection Close Cache-Control No-Cache Pragma No-Cache
}
}
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects