Jaime_Flores
Mar 07, 2018Nimbostratus
HTTP 2 HTTPS redir with internal and external URL's
Hi.
I'm having problems with a HTTP to HTTPS redirect for a especific VirtualServer. I explain the situation:
We have a F5 LTM that only works with internal URL's, and a reverse proxy that handles external URLs and sends them to F5. My site has both external and internal URL's (http://internal.myapp.com/site/myapp & http://externaldomain.com/site/myapp). Now, all works well with HTTP protocol, but the problem comes with the HTTP2HTTPS redirect. I'm using a simple iRule like this:
when HTTP_REQUEST {
HTTP::respond 301 Location "https://externaldomain.com[HTTP::uri]"
}
With internal URL we have no problem, I request http://internal.myapp.com/site/myapp and the F5 respond with https://internal.myapp.com/site/myapp (our DNS do the hard job). The problem is when I request the external URL, because the response is the internal URL: I request http://externaldomain.com/site/myapp and the response is https://internal.myapp.com/site/myapp. However, if I use the next iRule (with the URI hardcoded), all works fine:
when HTTP_REQUEST {
HTTP::respond 301 Location "https://externaldomain.com/site/myapp"
}
The question is: Why have I to put the complete URL?? Why the [HTTP::uri] var is not working??
Thanks for your response.