23-Aug-2018 06:21
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!
23-Aug-2018
06:27
- last edited on
02-Jun-2023
08:30
by
JimmyPackets
Try this:
when HTTP_REQUEST {
if { [HTTP::uri] equals "/"}
{
HTTP::redirect "https://[HTTP::host]/prl-ws//"
}
}
23-Aug-2018
07:27
- last edited on
21-Nov-2022
21:45
by
JimmyPackets
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//"
}
}
23-Jan-2023 00:23