Hi,
If you send a request 'GET /test.html' to the VIP, you aren't including the Host header, so the redirect will be to
https://test.html. If you make a request using 'GET /test.html HTTP/1.0\r\nHost: test.example.com' the HTTP::host command will return test.example.com. I would guess that the web server is assuming a default host value for the request.
You could add a check to the iRule which redirects to the VIP's IP address if no host is specified. Or if you know that clients can be redirected to a single domain, you could hard code it.
Here is an example of the first option:
when HTTP_REQUEST {
Check if Host header value has a length
if {[string length [HTTP::host]]}{
Redirect to the requested host
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
} else {
Redirect to VIP's IP address
HTTP::redirect https://[IP::local_addr][HTTP::uri]
}
}
If you wanted to hardcode the domain for redirects when the Host header doesn't have a value, just change [IP::local_addr] to the host you want.
Aaron