Forum Discussion
jaikumar_f5
Nov 13, 2018MVP
Something 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"
}
}