Forum Discussion
zhaleh_329474
Jan 08, 2019Nimbostratus
f5 irule redirect based on source ip
Hello
I want redirect to for specific 5 subnet ip address,and If these 5 addresses were not requested, they should be redirected to another address example to .
Yann_Desmarest_
Nacreous
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
zhaleh
Jan 08, 2019Nimbostratus
i test it but don't work
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