Forum Discussion
hooleylist
Sep 16, 2008Cirrostratus
Do 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