Forum Discussion
Irule for just redirecting traffic
Hey guys, came across some examples of redirecting based on IP address. I want to say this group of IPs gets redirected to this URL and that group of IPs gets redirected to that URL. I don't want a pool or proxy, I just want to redirect. This is what I have so far but I think I am missing something?
when HTTP_REQUEST {
if { [class match [IP::remote_addr] equals $::My_Subnets] } {
HTTP::redirect "https://site1.com"
} else
{HTTP::redirect "https://site2.com"
}
}
any help you can lend is greatly appreciated! Thanks Joe
2 Replies
- Vijay_E
Cirrus
Try:
when HTTP_REQUEST { if { [class match [IP::remote_addr] equals My_Subnets] } { HTTP::redirect "https://site1.com" } else { HTTP::redirect "https://site2.com" } }Edit: Removed $ from data group name.
- faheda_5424
Nimbostratus
What version are you on? The $:: for datagroups was deprecated a while back, so if you are on v11+ then you don't need that when referencing the datagroup. You would also want IP::client_addr vs remote_addr
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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