Hi - i have a following scenario;
HTTP VS - http://www.abc.com (redirecting to HTTPS) HTTPS VS - https://www.abc.com
Now customer wants to implement the following logic;
If anyone go to http://www.abc.com/CustomAB/* redirects it to http://xyz.test.com/services.txt
I have tried this irule on HTTP VS but it doesn’t work …
when HTTP_REQUEST { if { [HTTP::host] equals "; and [HTTP::path] equals “/CustomAB/*” } { HTTP::redirect "; } else { HTTP::redirect “https://[HTTP::host][HTTP::uri]” } }
Try this (untested):
when HTTP_REQUEST {
if { ([HTTP::host] eq "www.abc.com") and ([HTTP::uri] starts_with "/CustomAB/") } {
HTTP::redirect "http://xyz.test.com/services.txt"
} else {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
Hi,
[HTTP::host] contains only the host name without protocol (http, https).
when HTTP_REQUEST {
if { [HTTP::host] equals "www.abc.com" and [HTTP::uri] starts_with "/CustomAB/" } {
HTTP::redirect "http://xyz.test.com/services.txt"
} else {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}