Forum Discussion
12 Replies
- Marcus_Slawik_8Historic F5 Account
Why don't you check the uri at the beginning of each irule and then decide wether to continue with the rule or continue with the next?
But it would be cool if you could use CPM and have an iRule Action being triggered, but thats currently not possible if I'm not mistaken.
- Pradeep_KandalaNimbostratus
I could not understand how? Can you please give an example?
- LyonsG_85618Cirrostratus
Something like this.....
if {[HTTP::host] equals "domain.com") and [HTTP::uri] starts_with "/anything"}{ HTTP::respond 301 noserver Location "http://new.destination.com"
- Brad_ParkerCirrus
Do you need them to executed based on two different HTTP HOST names or two different URIs?
when HTTP_REQUEST { if {[HTTP::host] starts_with "something.com" } { Execute something.com iRule } elseif {[HTTP::host] starts_with "somethingElse.com" } { Execute somethingElse.com iRule } else { return } }
or
when HTTP_REQUEST { if {[HTTP::uri] starts_with "/something" } { Execute something iRule } elseif {[HTTP::uri] starts_with "/somethingElse" } { Execute somethingElse iRule } else { return } }
- Pradeep_KandalaNimbostratus
But I have to run two different iRules, for single domain based on uri. Is it still possible?
- nitassEmployee
Can we have two irule for the same virtual server, But running only one based on url ?
...
But I have to run two different iRules, for single domain based on uri. Is it still possible?
so, what do you want actually? do you want to execute only one irule based on url? or do you want to run both irules (based on url)?
- LyonsG_85618Cirrostratus
if you can give an example of what you actually require maybe we can help?
i.e.
www.abc.com/1 needs a redirect to www.xyz.com/2
or
www.abc.com/2 needs to be HTTPS only
- Pradeep_KandalaNimbostratus
No redirection, I need this based on URI not URL.
- LyonsG_85618Cirrostratuswhy don't you give us an example instead of making us guess what you need?
- nitassEmployee
is it something like this?
e.g.
configuration root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual norf ltm virtual norf { destination 172.28.24.10:80 ip-protocol tcp mask 255.255.255.255 pool foo profiles { http { } tcp { } } rules { rule1 rule2 } source 0.0.0.0/0 source-address-translation { type automap } vs-index 7 } root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule rule1 ltm rule rule1 { when HTTP_REQUEST priority 100 { if { [HTTP::uri] starts_with "/something" } { log local0. "uri=[HTTP::uri] executing rule1" event HTTP_REQUEST disable } } } root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule rule2 ltm rule rule2 { when HTTP_REQUEST priority 200 { log local0. "uri=[HTTP::uri] executing rule2" } } /var/log/ltm [root@ve11a:Active:In Sync] config tail -f /var/log/ltm Dec 11 16:42:29 ve11a info tmm[14890]: Rule /Common/rule1 : uri=/something/abc/123 executing rule1 Dec 11 16:42:49 ve11a info tmm1[14890]: Rule /Common/rule2 : uri=/anythingelse executing rule2
- Pradeep_KandalaNimbostratus
I could not understand the above, Does it mean out if iRule program(LTM level). I understand very little about the LTM. And How Do I allocate 3 iRules to a single virtual server?