Forum Discussion
CGI
Altostratus
Feb 12, 2013How to evaluate url search request
Hi i have a problem i need to resolve, whereby i need to filter search requests looking for requests that contain less than 3 characters and if they do
return a standard search result.
An e...
What_Lies_Bene1
Cirrostratus
Feb 12, 2013OK, understood. So here's what I think will work;
when HTTP_REQUEST {
Check if the path is the one used for search queries (and ignore case)
if { [string tolower [HTTP::path]] equals "/rtefacade_rightv/searchvideos" } {
Look for text 'expression' in the URI , skip forward 1 character (the '=')
and save all text up to the next '&' in variable 'searchstring'
set searchstring [findstr [HTTP::uri] "expression" "1" "&"]
If the length of 'searchstring' is 3 or less, change the URI sent
to the real server
if { string length $searchstring <= 3 } {
HTTP::uri "/SearchVideos/Result.html"
Stop processing the iRule here
return
}
}
}
The only bit I'm unsure about is this line, might need some square brackets??? 'if { string length $searchstring <= 3 } {'
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