Forum Discussion
f5 irule redirect based on source ip
Hi,
Here is a code sample that may help you :
when HTTP_REQUEST {
if { [IP::client_addr] eq "x.x.x.x" and [HTTP::host] eq "www.aaa.com" } {
HTTP::redirect http://www.bbb.com[HTTP::uri]
} else {
HTTP::redirect http://www.ccc.com[HTTP::uri]
}
}
That's just an example. You can have a look at IP::client_addr or class match commands to integrate a more complex lookup for a range of IP addresses.
You can also replace HTTP::redirect command by a HTTP::respond command.
Hope it helps
Yann
- zhalehJan 08, 2019Nimbostratus
i test it but don't work
- HamishJan 12, 2019Cirrocumulus
That's probably because it was (As Yann stated) an example...
if you'd like some more help please at least tell us what you actually tried, what went wrong and what diagnostics/debugging you attempted to find the issue.
if including a copy of your iRule, please put the code fences around it.
Recent Discussions
Related Content
* 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