Forum Discussion
Welson_Alexandr
Nimbostratus
May 18, 2007Route base on source address
This is my first try at iRules.
I would like to route a users to a pool in Data Center 1 if let's say they are coming from subnet 10.200.0.0 else redirect them to http://otherurl.com:8080 ...
Nathan_McKay_67
Nimbostratus
May 18, 2007You might want to structure this a bit differently and use the matchclass command with an appropriate data group to contain the desired source addresses to match against. Something like:
when HTTP_REQUEST {
if { not [ matchclass [ IP::client_addr ] equals $::subnet_group ] {
HTTP::redirect "http://otherurl.com:8080[HTTP::uri]"
}
}
Then just set the default pool for the VS to dev_testpool or whatever. This way you execute code to handle the exceptions, can manage stacked iRules a little better, and also redirect them to the URI that was originally requested (if you wanted to do that).
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