Forum Discussion
Fenton_376179
Nimbostratus
Nov 12, 2018Redirect device based on Source IP
HI.
I have an issue where we have two different VIPs/URLs servicing similar information to two different part of the company. This is normally ok, until somebody from one part copies their URL and s...
jaikumar_f5
Noctilucent
Nov 13, 2018Something like below would do, 1 common Irule that can be applied in both your VIP's. Create 2 datagroups with type IP and but the A users subnet in A_Users_Ips and B users subnet in B_Users_Ips.
Req:
- A users alone to access A website
- B users alone to access B website
- A users if access B website, redirect to A website.
- B users if access A website, redirect to B website.
Irule:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "www.a.com" and (![class match [IP::remote_addr] equals A_Users_Ips]) } {
HTTP::redirect "https://www.b.com[HTTP:uri]"
log local0. "User [IP::remote_addr] is NOT from A subnet and hence redirected to B website"
} elseif { [string tolower [HTTP::host]] equals "www.b.com" and (![class match [IP::remote_addr] equals B_Users_Ips]) } {
HTTP::redirect "https://www.a.com[HTTP:uri]"
log local0. "User [IP::remote_addr] is NOT from B subnet and hence redirected to A website"
}
}
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