« Do I still need apache httpd? | Main | Follow Up to Blog Editors for Vista »


Another Useful iRule::Redirect based on client IP

Another short but useful irule I put together for those times when a release is going in and you want your external customers to get redirected to a maintenance page while your internal testers can still get into the site in order to validate the release.

if { ! ([HTTP::uri] contains "/path/to/custom/errors")}{
if { ! ( [IP::addr [IP::client_addr] equals]) }{
HTTP::redirect https://www.somesite.com/path/to/custom/errors/maintenancePage.html

This irule redirects customers unless their client IP matches an internal subnet. The first line prevents a redirect loop from occurring. Whenever we commit a release, this rule gets enabled and works without a hitch. However, because we have lots of internal subnets scattered all over the world and with different partners, continually adding

"or [IP::addr [IP::client_addr] equals X] or ...."

statements can get tedious. So another alternative is to create a class of internal subnets and if the address does not equal one of those internal addresses, redirect.


TrackBack URL for this entry:

Listed below are links to weblogs that reference Another Useful iRule::Redirect based on client IP: