Forum Discussion
Michael_Powell1
Oct 04, 2010Nimbostratus
Redirect dependent on source IP address and URI
Hi there
I have created the following iRule for a shared application server:
when HTTP_REQUEST {
if {[matchclass [IP::remote_addr] equals $::private_net] && [HTTP::uri] contains "/uri_string_a/"}{
return
}
else {
HTTP::redirect "http://www.example.com/"
}
}
The intention is to redirect any traffic to a specific uri and not from an internal network to the url www.example.com. However, the iRule is redirecting all traffic for all sites on the application server to the alternative url. Could anyone tell me what I have done wrong please?
Thanks in advance
Regards
Mike
- Michael_Powell1NimbostratusOK my logic was broken. I wanted to check source IP address and destination URI then permit for a private address and redirect for a public address. Otherwise permit all other traffic. I have resolved it as follows:
- Chris_MillerAltostratusMichael, you can leverage CMP by eliminating the "$::" in front of your data group. Also, are you using 9.x or 10.x? If 10, you can also use "class match" instead of "matchclass"
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