Forum Discussion
starts_with Not working
Hi there,
the target url is "https://portal.abc.com/store/register.aspx?lang=en"
I tried to redirect the page when hit the above url with below irule, but it didn't work.
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/store/register.aspx" } {
HTTP::respond 200 content "It works"
} }
However, if I tried below by replacing "starts_with" to "contains", it somehow works, but this is not I want.
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] contains "register.aspx" } {
HTTP::respond 200 content "It works"
} }
My F5 version is "BIG-IP 10.2.2 Build 852.0 Hotfix HF1".
Thanks.
3 Replies
- John_Beckmann
Employee
Have you tried adding some logging, so you can see what [HTTP::uri] is? Have you tried adding some logging, so you can see what [HTTP::uri] is? when HTTP_REQUEST { if { [string tolower [HTTP::uri]] contains "register.aspx" } { log local0. "HTTP::URI: [HTTP::uri]" HTTP::respond 200 content "It works" } } This will log on /var/log/ltm - John_Beckmann
Employee
Have you tried adding some logging, so you can see what [HTTP::uri] is?
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] contains "register.aspx" } { log local0. "HTTP::URI: [HTTP::uri]" HTTP::respond 200 content "It works" } }This will log on /var/log/ltm
- Thomas_Lam
Nimbostratus
Thanks John. I have added the logging, and it shows as below. It seems the HTTP::uri is returned as expected, but somehow I'm not sure if the "starts_with" is not working properly, or somewhere I missed out. Thanks.
Rule Testing_Block : HTTP::URI: /store/register.aspx?lang=en
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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