Forum Discussion
Chris_Schaerli_
Nimbostratus
17 years agoRedirect or rewrite?
Hi,
I am trying to setup something to direct traffic based on source IP. We are rolling out an application and we want to do it in phased approach.
This is what I had to start.
when HTTP_REQUEST {
if { [IP::addr [IP::remote_addr] equals 10.32.186.0/255.255.252.0] } {
HTTP::redirect “https://site.com/portal/site/NEW"
} elseif {[IP::addr [IP::remote_addr] equals 10.20.20.0/255.255.252.0] } {
HTTP::redirect http://site.com/portal/site/OLD
} elseif {[IP::addr [IP::remote_addr] equals 10.0.0.0/255.0.0.0] } {
HTTP::redirect "https://site.com/portal/site/OLD"
}
}
I applied this Irule to both VIPS for http://site.com and https://site.com , but I found when I my traffic was looping. I guess I can’t redirect on the same VIP that I want to direct traffic to? Do I have to use a URL instead of a redirect?
when HTTP_REQUEST {
if { [IP::addr [IP::remote_addr] equals 10.32.186.0/255.255.252.0] } {
HTTP:uri "https://site.com/portal/site/NEW"
}elseif {[IP::addr [IP::remote_addr] equals 10.32.186.0/255.255.252.0] } {
HTTP:uri "http://site.com/portal/site/OLD"
} elseif {[IP::addr [IP::remote_addr] equals 10.0.0.0/255.0.0.0] } {
HTTP::uri "https://site.com/portal/site/OLD"
}
}
Thanks,
Chris
13 Replies
No RepliesBe the first to reply
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