Forum Discussion
Stop processing iRule(s) if condition is met.
Hi,
Im hosting a site with two virtual servers http and https.
My http virtual server is just a set of rules that redirects to the https virtual server.
One visitor of my site needs to access some parts in http, and i have made a iRule that distinguish the traffic and sends it directly to the pool. No redirection. :
when HTTP_REQUEST {
if { ([string tolower [HTTP::uri]] contains "/globalassets/global/") and [IP::remote_addr] contains "XXX.XXX" } {
pool dummy_web_pool
log 10.X.X.X local0.info "http Client Connected, IP: [IP::client_addr]"
return
}
I can from my syslog see that the iRule hits, but i still get a 301 redirect response. Even though this iRule is top priority, it seems like it continues to read my other lower priority https redirection irules.
How can bypass my other iRules if the condition is met?
9 Replies
- Hannes_Rapp
Nimbostratus
Use the
command after calling your conditional actions, to disable further processing of HTTP_REQUEST event. Use theevent disable
command to stop further processing all iRule events.event disable allGood luck 😃
- eirikn
Nimbostratus
Thanks for quick response! event disable did the trick! - Yes, return will just return from control from the current code block (event), it won't return from all iRules.
- AmalW_114471
Nimbostratus
Thanks a lot @Hannes Rapp That did the trick for me too.. We were struggling with adding maintenacne page redirection irules where we have x-forwarded-header inserts. This is just what we were looking for..
Thanks again!!!
- Hannes_Rapp_162
Nacreous
Use the
command after calling your conditional actions, to disable further processing of HTTP_REQUEST event. Use theevent disable
command to stop further processing all iRule events.event disable allGood luck 😃
- eirikn
Nimbostratus
Thanks for quick response! event disable did the trick! - Yes, return will just return from control from the current code block (event), it won't return from all iRules.
- AmalW_114471
Nimbostratus
Thanks a lot @Hannes Rapp That did the trick for me too.. We were struggling with adding maintenacne page redirection irules where we have x-forwarded-header inserts. This is just what we were looking for..
Thanks again!!!
- dragonflymr
Cirrostratus
Hi,
Will if elseif pair not solve this as well, so when if condition (special client) is true pool action is performed, if it's not true redirection to https is performed? Just iRule newbie question.
Piotr
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
