Forum Discussion
mattias_56723
Nimbostratus
Sep 10, 2009simple filter question of uri
If I want to filter out "?listall=1" and also "log=0" in the uri.
ex: http://testsite.com/test.aspx?listall=1?log=0
to http://testsite.com/test.aspx
How will the syntax look like ?
Best regards
Max
14 Replies
Sort By
- hoolio
Cirrostratus
Hi Max, - The_Bhattman
Nimbostratus
One of your examples doesn't look right to me - hoolio
Cirrostratus
I'm guessing that's just a typo in the post. The query string delimiter should be a question mark and the parameter value / parameter name delimiter is the &. - The_Bhattman
Nimbostratus
I figured as much but I wanted to be sure. - mattias_56723
Nimbostratus
ex: http://testsite.com/test.aspx?pageid=13&nocache=1&list=11 - hoolio
Cirrostratus
You could use something like this: - mattias_56723
Nimbostratus
Thanks for the response! - hoolio
Cirrostratus
Hi Max,when HTTP_REQUEST { Debug logging log local0. "[IP::client_addr]:[TCP::client_port]: New [HTTP::method] request to [HTTP::uri]" Check if client is not in internal range if {not ([IP::addr [IP::remote_addr] equals 10.0.0.0/8])} { Save copy of URI set uri_tmp [HTTP::uri] Check if URI contains nocache=1 if {[URI::query [HTTP::uri] nocache] == 1}{ Save updated URI with nocache removed set uri_tmp [string map {nocache=1 ""} [HTTP::uri]] } Check if list parameter is set with any value if {[URI::query [HTTP::uri] list] ne ""}{ Save updated URI without list parameter and value set uri_tmp [string map [list "list=[URI::query [HTTP::uri] list]" ""] $uri_tmp] } Clean up any double delimiters from $uri_tmp and update the URI HTTP::uri [string map {?& ? && &} $uri_tmp] } } when HTTP_REQUEST priority 501 { Debug logging log local0. "[IP::client_addr]:[TCP::client_port]: Current URI: [HTTP::uri]" }
- mattias_56723
Nimbostratus
it works like a dream, Thanks! - mattias_56723
Nimbostratus
I also need to have an list of URI:s that i wan't to block.
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