Forum Discussion
Supahoopsa_8892
Nimbostratus
Jun 10, 2011IRule not working - sytnax error or something else?
I have tried writing my first iRule to check the url of my site and then depending on which site the user is attempting to access, I then check a list of approved IP addresses.
If t...
Michael_Yates
Nimbostratus
Jun 10, 2011Try this:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"*XXX*" {
if { !([matchclass [IP::client_addr] equals $::XXX_access_list]) } {
HTTP::redirect https://MyXXXUnauthPage.com
}
}
"*YYY*" {
if { !([matchclass [IP::client_addr] equals $::YYY_access_list]) } {
HTTP::redirect https://MyYYYUnauthPage.com
}
}
"*ZZZ*" {
if { !([matchclass [IP::client_addr] equals $::ZZZ_access_list]) } {
HTTP::redirect https://MyZZZUnauthPage.com
}
}
}
}
Your not comparison (can also be expressed by "!"), needs to be inside of your if statement and needs to be applied to the entire comparison.
Comparison: [matchclass [IP::client_addr] equals $::ZZZ_access_list]
Comparison: !(results of first comparison)
Result: if false, do this....
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