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
Have you tried logging any data to see what's wrong with your logic? That should always be the first step in diagnosing a problem. One thing I noticed is that you'll want to use the HTTP::redirect command instead of "redirect to".
when CLIENT_ACCEPTED {
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"
}
}Run your traffic through this and then look at the /var/log/ltm file. It should point you right to your problem. Make sure you comment out or remove the log statements when you move this into production.
-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
