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 that is a VIP in Data Center 2
Will this work:
when CLIENT_ACCEPTED {
if { [IP::addr [IP::client_addr]/8 equals 10.200.0.0] } {
pool dev_testpool
} else {
HTTP::redirect "http://otherurl.com:8080/"
}
}
- Nathan_McKay_67
Nimbostratus
You 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]" } }
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