Forum Discussion
Allanwynn_16283
Nimbostratus
Oct 17, 2015Redirect to an internal site based on client source network (IP)
Hi all,
I am not really familiar with iRule, so can you help me:
An iRule where it is based on client's source network (not specific IP) to be redirected to an internal site?
i.e. 172.1...
Oct 17, 2015
Hi
Try these?
iRule 1
when HTTP_REQUEST {
if { [IP::addr [IP::client_addr]/24 equals 192.168.1.0/24] } {
HTTP::respond 301 Location "http://mysite1.com"
} else {
HTTP::respond 301 Location "http://mysite2.com"
}
}
iRule 2
when HTTP_REQUEST {
set lastoctet [lindex [split [IP::client_addr] .] 3]
if { [expr $lastoctet % 2] == 1 } {
HTTP::respond 301 Location "http://mysite1.com"
} else {
HTTP::respond 301 Location "http://mysite2.com"
}
}
/Patrik
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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