带有url路径的Apache ProxyPass



我有一个域名,例如example.com,它指向jboss服务器

当我访问https://example.com,运行良好。

应用程序部署在根路径中。(即上下文根是"/"(

它通过apache代理指向jboss服务器。

<VirtualHost *:443>
ServerName example.com
ServerAlias example.com
SSLProxyEngine on
SSLProxyCheckPeerCN on
ProxyPreserveHost On
AllowEncodedSlashes NoDecode
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
ProxyPass / https://10.xx.0.6:8443/
ProxyPassReverse / https://10.xx.0.6:8443/
...
</VirtualHost>

另一个web应用程序("therapp"(部署在同一jboss服务器上。上下文根是"/therap&;然后我想通过这样的url访问网络应用程序";https://example.com/otherapp/"或";https://otherapp.example.com/">

有可能吗?

您可以使用apache的<位置>指令

...
<Location /otherapp>
ProxyPass https://10.xx.0.6:8443/
ProxyPassReverse https://10.xx.0.6:8443/
</Location>

这里有更多帮助:是否可以在ProxyPass/ProxyPassReverse中使用相对路径?

Apache文档(注意尾部的斜杠(:https://httpd.apache.org/docs/2.4/mod/core.html#location

最新更新