Forum Discussion
Kenny_Van_73892
Nimbostratus
Dec 28, 2006The second "if"
Did I do anything wrong with my irules below that my second embeded "if" never got to process?
I have a website which consists of http and https, let say https://www.mysite.com/admin/logon.aspx. If an user goes to http://www.mysite.com, the Big IP needs to send traffic to pool1 which loads balance accross the nodes. If an user goes to logon.aspx, the Big IP needs to send traffic to pool2 and pool2 consist of a single node.
Here's my irules:
if (http_uri contains "/admin") {
redirect to "https://" + tolower(http_host) + tolower(http_uri)
if (http_uri contains "/logon.aspx") {
log "sslpool2" + client_addr
use pool pool2
}
else {
discard
}
}
else {
use pool1
}
The redirect worked just fine, but when I checked the pool2 statistic and never seen traffic goes thru. I checked the log "sslpool2" and never seen traffic hit pool2 either. This tells me that the second embeded "if" never had a chance to run.
What should I do to get the second "if" to run?
Thanks in advance.
- Kenny_Van_73892
Nimbostratus
Anyone knows why ? - hoolio
Cirrostratus
Hello puma,if (http_uri contains "/admin") { redirect to "https://" + tolower(http_host) + tolower(http_uri) if (http_uri contains "/logon.aspx") { log "sslpool2" + client_addr use pool pool2 } else { discard } } else { use pool1 }
- Martin_MachacekHistoric F5 AccountYour second if has no chance to be executed because the the evaluation terminates on the redirect to statement. Rule evaluation terminates if a use, redirect to or discard statement is reached. I'm not sure what you want to achieve. It is not clear from your description whether http://www.mysite.com/admin/logon.aspx should be sent to pool2 or a redirected to HTTPS.
- Kenny_Van_73892
Nimbostratus
Thanks for all your responses. - Kenny_Van_73892
Nimbostratus
Thanks mmac. - Kenny_Van_73892
Nimbostratus
Can you please give me an idea how to have 2 rules apply to a single virtual server? I know how in version 9.x, but not sure how to have 2 rules in version 4.x. - Martin_MachacekHistoric F5 AccountIn v4.x a virtual can reference only one rule.
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