我们使用反向代理来允许防火墙外的用户访问内部服务器上的服务。然而,尽管我们使用
ProxyPreserveHost
指令,带有URL的请求
http://project.domain.com/index.html
导致
http://internal.server/index.html
而不是预期的
http://project.domain.com/index.html
。
以下是我们的虚拟主机定义:
<VirtualHost *:443>
ServerName "https://project.domain.com"
SSLEngine on
SSLCertificateFile /etc/ssl/our.cer
SSLCertificateKeyFile /etc/ssl/private/our.key
ProxyRequests Off
ProxyVia Off
<Proxy *>
Require all granted
</Proxy>
ProxyPreserveHost On
ProxyPass / http://internal.server:80/
ProxyPassReverse / http://internal.server:80/
</VirtualHost>