Forum Discussion
Multiple conditions in iRule
Hi,
I'm trying to do multiple conditions in my iRule, however I only have the first condition working, the iRule doesn't go through the second condition:
when HTTP_REQUEST {
if { [HTTP::host] contains "euhreka.apps.com" }{
HTTP::redirect "https://hr.entreprise.net/tp-hr2/modules/euhreka/euHReka.htm"
}
if { [HTTP::host] contains "euHReka.hr.com" }{ HTTP::redirect "; } }
Can you please advise what should I change on my iRule to make it works ?
Thank you
- Ed_Summers
Nimbostratus
Is that an exact replication of your iRule? The second 'if' condition includes upper-case characters in the test statement. The HTTP Host header evaluation should be case insensitive. Typically your test string will be all lower-case, and you can take a step further by performing a 'string tolower [HTTP::host]' to ensure the header value is all lowercase, though not necessary in many cases. Change your second test string to "euhreka.hr.com".
(Reference the HTTP::host page on DevCentral)
If the issue was that you could never match to the second 'if' condition, this is likely your issue. There also appears to be a trailing semi-colon after the HTTP::redirect in your second section - was that intentional?
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