It seems like this should be simple…
I want to use a single rule on multiple virtual servers to redirect traffic to another site. Simplified -
If the incoming request is HTTP://host.com/??? redirect to HTTP://host.net/???
If the incoming request is HTTPS://host.com/??? redirect to HTTPS://host.net/???
What I wrote was:
when HTTP_REQUEST {
HTTP::redirect “[URI::protocol [HTTP::request]]://host.net[HTTP::uri]”
}
Unfortunately this doesn’t work because [HTTP::request] does not include the protocol.
The URI::protocol command seems like it should do what I want - except I can’t seem to figure out how to feed it the entire request (https://host.com/???).
The examples given for URI::protocol have it parsing a literal string - ie:
when HTTP_REQUEST {
set url “http://www.foo.com/app/file.ext”
proto will be “http”
set proto [URI::protocol $url]
}
This is the behavior I need - except I need to evaluate the incoming request, not a literal string.
What am I missing?
Thanks!