Forum Discussion
irule execution sequence
I have two tests to perform. If the first rule is enacted, I don't want the second one to happen - how do I order the rules or combine them to make sure they both don't apply to the same request?
rule portal-8080 {
when HTTP_REQUEST {
if { [HTTP::host] eq "portal.com" } {
pool portal.8080-only
} else {
pool poolb
}
rule http2https
when HTTP_REQUEST { HTTP::redirect https://[HTTP::header host][HTTP::uri]}
}
}
virtual hpssopro_80 {
destination 10.10.10.15:http
rules portal-8080 http2https
11 Replies
- nitass
Employee
there are a couple of options. first is to use event disable command. event https://clouddocs.f5.com/api/irules/event.html second is to set variable in one event/irule and then check it in another event/irule (to decide whether event/irule will be executed or not). - shaggy
Nimbostratus
helpful article regarding iRule Stacking:
Stacking iRules: A Modular Approach https://devcentral.f5.com/articles/stacking-irules-a-modular-approach
- sally_calvert_8
Nimbostratus
I did read that one...but thanks anyway
- sally_calvert_8
Nimbostratus
I did check out both those. Basically, if the fqdn matches, I don't want the http-to-https redirect to happen- just looking for confirmation that this is what that does. I don't have a test device to try it out on.
thanks
- sally_calvert_8
Nimbostratus
oh wait - will this one do what I want above?
b rule portal-8080-redirect '{ when HTTP_REQUEST { if { [HTTP::host] eq "portal..us" } { pool portal-8080-only } else { when HTTP_REQUEST { HTTP::redirect https://[HTTP::header host][HTTP::uri]} } } }'
- sally_calvert_8
Nimbostratus
thank you all - this makes perfect sense now.
- sally_calvert_8
Nimbostratus
so I got a chance to test, and it doesn't work - I put in a log local0, and see that the HTTP::host is exactly what I am expecting, but the pool selection doesn't trigger. What other ideas do you all have?
b rule portal-8080-redirect '{ when HTTP_REQUEST { if { [HTTP::host] eq "portal.somestate.us" } { pool portal-8080-only } else { HTTP::redirect https://[HTTP::host][HTTP::uri] }}}'
- nitass
Employee
I put in a log local0, and see that the HTTP::host is exactly what I am expecting, but the pool selection doesn't trigger.
how do you know? have you checked tcpdump?
- sally_calvert_8
Nimbostratus
this would be one of those "duh" moments...the pool was down!! So I got the rule working, and thank all of you for you help on this one!
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