Forum Discussion
ervinc_27883
Nimbostratus
Feb 01, 2012irule to redirect base on ip and path
This is giving me a rule error wrong args. I'm a newbie and need help on fixing this irule.
thanks for all your help.
when HTTP_REQUEST {
set my_uri [string tolower [HTTP::uri]]
if { $my_uri starts_with "/irj/portal" and [IP::addr [IP::remote_addr] equals 10.0.0.0 mask 255.0.0.0] } {
redirect to "http://web1"
} }
2 Replies
- hoolio
Cirrostratus
Hi,
The main change to make is replacing redirect to with HTTP::redirect. SAP should be case sensitive also, so you can remove the string tolower. Lastly, the most efficient format for using subnets with the IP::addr command is with CIDR on the network address:
http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/1086449/iRules-IP-Comparison-Considerations-with-IPaddr-Command.aspxwhen HTTP_REQUEST { if { [HTTP::uri] starts_with "/irj/portal" and [IP::addr [IP::remote_addr] equals 10.0.0.0/8] } { HTTP::redirect "http://web1[HTTP::uri]" } }
Aaron - ervinc_27883
Nimbostratus
thank you so much. will try it out.
Thanks again for all your help.
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