Forum Discussion
sidiov
Nimbostratus
Mar 17, 2009Redirecting specific java strings in uri
I have a redirection query that currently redirects the root page based on the browser type.
when HTTP_REQUEST {
if { [HTTP::path] equals "/" }{
if { [HTTP::header "User-Agent"] contains "soviet" }
{HTTP::redirect "http://soviet.com/"}
}
}
this works just fine.
However now I have to pick a specific instance where a jquery is passed in the uri to NOT redirect. I tried the following, but it prevented all access to the site from the browser.
when HTTP_REQUEST {
if { [HTTP::path] equals "/" }{
if { not [string tolower [HTTP::uri]] starts_with "/?user=soviet" }{
if { [HTTP::header "User-Agent"] contains "soviet" }
{HTTP::redirect "http://soviet.com/"}
}
}
}
What would the correct way of doing this be?
- hoolio
Cirrostratus
I think the problem is with the logical not. If you wrap what you want to negate in parentheses does it work?when HTTP_REQUEST { if { [HTTP::path] equals "/" }{ if { not ([string tolower [HTTP::query]] starts_with "user=soviet") }{ if { [HTTP::header "User-Agent"] contains "soviet" }{ HTTP::redirect "http://soviet.com/" } } } }
- sidiov
Nimbostratus
Thank you, that was it.
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