Forum Discussion
Simple iRule failing
I am trying to implement what I thought would be a very simple iRule but I'm unable to get it to process successfully. I am trying to issue a 302 HTTP redirect based on the presence of a specific URI:
when HTTP_REQUEST { if { [ string tolower [HTTP::uri]] contains "/httpservices/login/loginService.aspx"} { HTTP::redirect https://login.devstage1.weightwatchers.com/mobilelogin/mobile log local0. "Chassis Redirect" } }
Am I misunderstanding how the HTTP redirect function works or am I just making a syntax mistake?
3 Replies
- R_Eastman_13667Historic F5 Account
Because you are comparing a tolower string to a mixed case string, the evaluation will never be true. Change your URI to the below. Notice Service is now service.
when HTTP_REQUEST { if { [ string tolower [HTTP::uri]] contains "/httpservices/login/loginservice.aspx"} { HTTP::redirect https://login.devstage1.weightwatchers.com/mobilelogin/mobile log local0. "Chassis Redirect" } } - Eric_St__John
Employee
You have an upper case S in your "contains", but you've used string tolower. The following is a tad more efficient if you are only concerned with the path, and not the parameters. Also, you should probably scrub your code prior to posting next time:
when HTTP_REQUEST { if { [string tolower [HTTP::path]] contains "/httpservices/login/loginservice.aspx"} { HTTP::redirect https://login.devstage1.weightwatchers.com/mobilelogin/mobile log local0. "Chassis Redirect" } }Eric
- Art_Sholty_6751
Nimbostratus
Thanks for the help. I figured this out on my own about a minute after posting, but I appreciate the help. Eric you should feel free to ignore any code you consider to be unscrubbed.
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