Forum Discussion
dacrud_18985
Nimbostratus
Sep 16, 2008remove everything after question mark
Hi all,
I have a URL like so:
http://www.domain.com/popular_stuff/list/5?id_session=BLAHBLAHBLAHBLAH
and I need to strip everything after the question mark...
hoolio
Cirrostratus
Sep 16, 2008Do you want to redirect the client with the updated path-only location or do you want to rewrite it before the request is sent to the pool? Do you want to do this with all requests that contain a query string?
With a redirect, the browser's address bar will show the update. With a rewrite it will not be modified. Here are two examples:
Rewrite:
when HTTP_REQUEST {
Check if there is a query string in the URI
if {[string length [HTTP::query]]}{
Rewrite the URI to remove the query string
HTTP::uri [HTTP::path]
}
}
Redirect:
when HTTP_REQUEST {
Check if there is a query string in the URI
if {[string length [HTTP::query]]}{
Redirect the client to the same host and the path (URI without the query string)
HTTP::redirect http://[HTTP::host][HTTP::path]
}
}
For more info on the commands, you can check the iRules wiki pages:
HTTP::path (Click here)
HTTP::uri (Click here)
HTTP::redirect (Click here)
Aaron
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