apache2 - apache 2 proxypassreverse appends virtualhost port -
i have been trying setup reverse proxy using apache 2 mod_proxy , proxypass & proxypassreverse directives.
i installing wso2 identity server , wish access app using url such following .
hxxp://myserver.domain.com/wso2/
the myserver.domain.com
accessible on internet
internally on network have set virtualhost running in apache2 configuration following parameters:
for various reasons, port 80 unavailable , virtualhost must stay :8080.
finally, here 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>
the issue:
i can use web browser ( firefox/chrome) request http://myserver.domain.com/wso2/ resource. in log files see request hit apache server , virtualhost catches /wso2/ location.
it passes through proxy , lands on internal.wso2.node server. however, product wso2 preforms several redirects which, in log files see requesting resource port appended.
here 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 web browser hxxp://myserver.domain.com:8080/wso2/carbon/admin/login.jsp
for reason apache response appends virtual host url requesting.
if remove port:8080 , request again full url access resource fine. attempt access using http://myserver.domain.com/wso2/ result in redirects , port appended.
as per covener's suggestion culprit in case proved following directives:
usecanonicalname off usecanonicalphysicalport off
additionally, web app trying access makes use of sessions , cookies, therefore must proxy those, see added directives under proxypass & proxypassreverse.
therefore updated virtualhost configuration file should this
<virtualhost *:8080> servername: myserver.domain.com usecanonicalname off usecanonicalphysicalport off <location /wso2/> proxypass hxxps://internal.wso2.node:9443/ proxypassreverse hxxs://internal.wso2.node:9443/ proxypassreversecookiepath / /wso2/ proxypassreversecookiedomain internal.wso2.node myserver.domain.com </location> proxyvia on proxypreservehost off proxyaddheaders off proxyrequests off sslproxyengine on sslproxycheckpeercn off </virtualhost>
Comments
Post a Comment