Forum Discussion
Christopher_Da1
Nimbostratus
Aug 08, 2006iRule to manipulate designation content based off ip/subnet
First of all I’m new to iRules and not familiar with the syntax.
I have composed an irule and the editor says the syntax is correct, but it doesn’t behave correctly or the way I intend for i...
Aug 08, 2006
Looks like you'll have to specifically set that variable to zero to avoid the no such variable error.
when CLIENT_ACCEPTED {
set issue_redirect 0
log local0. "client address: [IP::client_addr]"
if { [IP::addr [IP::client_addr] equals 156.74.138.63] } {
log local0. "matched address 156.74.138.63"
pool GWWEB-HTTP
} elseif { [IP::addr [IP::client_addr] equals 156.74.12.223] } {
log local0. "matched address 156.74.12.223"
pool GWWEB-HTTP
} elseif { [IP::addr [IP::client_addr] equals 156.74.12.222] } {
log local0. "matched address 156.74.12.222"
pool GWWEB-HTTP
} elseif {not[IP::addr [IP::client_addr] equals 156.74.16.0/24] } {
log local0. "matched subnet 156.74.16.0/24"
set issue_redirect 1
} else {
log local0. "didn't match any addresses"
pool GWWEB-HTTP
}
}
when HTTP_REQUEST {
log local0. "issue_redirect: $issue_redirect"
if { $issue_redirect == 1 } {
log local0. "issuing redirect..."
HTTP::redirect "http://inweb.ci.seattle.wa.us/ccss/noaccess.asp"
}
}Give that a whirl...
-Joe
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
