I have been trying to setup a reverse proxy using apache 2 mod_proxy and the proxypass & proxypassreverse directives.
I am installing WSO2 Identity Server and wish to access that app using a url such as the following .
myserver.domain.com is accessible on the internet
Internally on my network I have set up a virtualhost running in my apache2 configuration with the following parameters:
For various reasons, port 80 is unavailable and the virtualhost must stay as :8080.
Finally, here is my virtual host configuration
<VirtualHost *:8080> <Location /wso2/> ProxyPass hxxps://internal.wso2.node:9443/ ProxyPassReverse hxxs://internal.wso2.node:9443/ </Location> ProxyVia On ProxyPreserveHost Off ProxyAddHeaders Off ProxyRequests Off SSLProxyEngine On SSLProxyCheckPeerCN Off </VirtualHost>
I can use my web browser ( Firefox/Chrome) to request the http://myserver.domain.com/wso2/ resource. In my log files I see that the request does hit the apache server and the virtualhost catches the /wso2/ location.
It passes through the proxy and lands on the internal.wso2.node server. however, the product WSO2 IS preforms several redirects which, in the log files I see it requesting the resource with the port appended.
Here is the request flow
hxxp://myserver.domain.com/wso2/ -> hxxps://internal.wso2.node:9443/ REDIRECT x3 hxxps://internal.wso2.node:8080/carbon -> hxxps://internal.wso2.node:8080/carbon/admin/login.jsp Back to my web browser hxxp://myserver.domain.com:8080/wso2/carbon/admin/login.jsp
For some reason the apache response back appends its virtual host to the url I am requesting.
If I remove the port:8080 manually and request again the full url in the browser it will access the resource fine. However any attempt to access using only http://myserver.domain.com/wso2/ will result in redirects and the port appended.