Forum Discussion
JayrodEF_161281
Nimbostratus
Feb 08, 2016Parse URI to remove specified value if present, then return the rest
Hello, I'm working with a customer who would like an iRule that would remove "?asm=true" from the uri if it is present. At that point, it would just pass along the rest of the request without the "?asm=true" part. Any ideas on how to do that?
Thanks!
1 Reply
Hi Jayrod,
If the
query is already send by the user, then try this snippet...asm=truewhen HTTP_REQUEST { if { [HTTP::query] contains "asm=true" } then { if { [HTTP::query] equals "asm=true" } then { HTTP::uri [HTTP::path] } elseif { [HTTP::query] starts_with "asm=true&" } then { HTTP::uri [string map [list "asm=true&" ""] [HTTP::uri]] } else { HTTP::uri [string map [list "&asm=true" ""] [HTTP::uri]] } } }If the
query is injected by ASM (I duno if ASM add this param?), then you may try this snippet...asm=truewhen HTTP_REQUEST_SEND { clientside { if { [HTTP::query] contains "asm=true" } then { if { [HTTP::query] equals "asm=true" } then { HTTP::uri [HTTP::path] } elseif { [HTTP::query] starts_with "asm=true&" } then { HTTP::uri [string map [list "asm=true&" ""] [HTTP::uri]] } else { HTTP::uri [string map [list "&asm=true" ""] [HTTP::uri]] } } } }Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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