Forum Discussion
smiley_dba_1116
Jun 21, 2012Nimbostratus
Whitelist a iRule, otherwise redirect
Need some help creating an iRule. The idea is that I have a VS, and I will be associating a iRule to do a redirect, but I dont want to do a redirect if a the IP/Subnet is in the iRule data group. I t...
hooleylist
Jun 22, 2012Cirrostratus
If you're on 9.4.4 or higher make sure to remove the $:: prefix from the data group name. You can add debug logging to figure out why the iRule isn't working. Here's a version 10 or higher example:
when HTTP_REQUEST {
if { [class match [IP::client_addr] equals Whitelist_Sorry] } {
log local0. "[IP::client_addr]:[TCP::client_port]: Client is in data group so do not redirect. DG: [class get Whitelist_Sorry]"
} else {
log local0. "[IP::client_addr]:[TCP::client_port]: Client is not in data group so redirect"
HTTP::redirect
}
}
Also, [IP::client_addr] and [IP::remote_addr] will return the same value in clientside events like CLIENT_ACCEPTED and HTTP_REQUEST.
Aaron
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