我正在尝试设置一个带有多个 Web 应用程序的服务器,这些应用程序都将通过 apache VirtualHost(在同一台服务器上运行的 apache)提供服务。我的主要限制是每个 Web 应用程序都必须使用 SSL 加密。在谷歌搜索了一段时间并查看了有关stackoverflow的其他问题后,我为VirtualHost编写了以下配置:
<VirtualHost 1.2.3.4:443>
ServerName host.example.org
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
SSLProxyEngine On
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / https://localhost:8443/
ProxyPassReverse / https://localhost:8443/
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
尽管https://host.example.org:8443是可访问的,https://host.example.org不是,这违背了我的虚拟主机配置的目的。Firefox 抱怨说,即使它成功连接到服务器,连接也被中断。我还在 apache 的 error.log 中收到以下警告:
proxy: no HTTP 0.9 request (with no host line) on incoming request and preserve host set forcing hostname to be host.example.org for uri
Run Code Online (Sandbox Code Playgroud)
在 Web 应用程序(Tomcat 服务器)上,访问日志显示了一个奇怪的访问请求:
"?O^A^C / HTTP/1.1" 302
Run Code Online (Sandbox Code Playgroud)
以下是我直接连接到https://host.example.org:8443时得到的正确访问请求:
"GET …Run Code Online (Sandbox Code Playgroud)