Forum Discussion
Adding a URI using IRULE
I want to add a URI using an irule. I saw different articles but could not find any one exactly matching my requirement.
Below is the requirement.
When I hit a VIP it should add a URI at the end. For example,
> /prl-ws//
Any help would be really appreciated.
Thanks!
Try this:
when HTTP_REQUEST { if { [HTTP::uri] equals "/"} { HTTP::redirect "https://[HTTP::host]/prl-ws//" } }
- Stanislas_Piro2Cumulonimbus
Do you want to redirect (HTTP response 302 or 307 with new URL location header) or forward with new URI.
If you want to redirect use this code (Never insert the Host header in the redirect if the protocol and the host are the same than the client request):
when HTTP_REQUEST { don't evaluate the uri but the path (without query string) if { [HTTP::host] equals "restricted-list" && [HTTP::path] equals "/"} { Change only the path part, keep the query string Use 307 instead of 302 (default redirect command) to force the client to post data if the first request was a POST. HTTP::respond 307 Location "/prl-ws/[HTTP::uri]" } }
If you want to forward and change the URI in serverside request
when HTTP_REQUEST { don't evaluate the uri but the path (without query string) if { [HTTP::host] equals "restricted-list" && [HTTP::path] equals "/"} { Change only the path part, keep the query string HTTP::path "/prl-ws//" } }
- Mohammed_TaherNimbostratus
Recent Discussions
Related Content
* 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