Forum Discussion
Ted_Smith_11168
Nimbostratus
Aug 24, 2005Help with multiple conditions in if statement
Still new to iRules and looking for help:
I need to merge the logic of two separate iRules into a single rule, but I'm not sure of the best method. I need to check for the existance of a cookie AND match a url condition before allowing traffic to a pool.
Here are the two separate rules:
Rule 1
url host.com/xxxxx change to host.com/templates/iquote010.cfm?ID=xxxxx
when HTTP_REQUEST {
set uri [string trimleft [HTTP::uri] "/"]
set host [HTTP::host]
set new_uri /Templates/IQuote010.cfm?ID=
set new_url $host$new_uri$uri
if { [HTTP::uri] starts_with "/Templates" or [HTTP::uri] starts_with "/images" } {
use pool UITShared
}
else {
HTTP::redirect http://$new_url
}
}
Rule 2
If cookie exists allow to pool, else redirect with original uri
when CLIENT_ACCEPTED {
set ckname uitaac1
set ckvalue [IP::client_addr]
set ckdomain .allied.nwie.net
}
when HTTP_REQUEST {
set uri [HTTP::uri]
if {[HTTP::cookie exists $ckname]} {
pool UITShared
}
else {
HTTP::redirect "https://uitaac.allied.nwie.net$uri"
}
}
I need to make sure the uri has matched the new format and the cookie exists before I allow to pool.
Any ideas?
No RepliesBe the first to reply
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