我不知道为什么替代指令不起作用。 反向代理后面的应用程序是Liferay,因为它生成绝对url,所以我必须在代理中进行replace。 此外,我需要在请求发送到后端应用程序之前更改主机名称。
这是我的httpd conf:
<VirtualHost *:443> ServerName site1.example.com SSLEngine On SSLCertificateFile /etc/httpd/conf/any.example.com.crt SSLCertificateKeyFile /etc/httpd/conf/any.example.com.key ProxyPass /Shibboleth.sso/ ! ProxyPass / http://10.0.0.4:8080/ ProxyPassReverse / http://10.0.0.4:8080/ RequestHeader set Host "site2.example.com" ProxyPreserveHost On # Mandatory for changing the host AddOutputFilterByType SUBSTITUTE text/html Substitute "s|site2.example.com|site1.example.com|ni" </VirtualHost>
问题是我总是得到结果(HTML)url指向site2.example.com。 例如,我有:
<a href="https://site2.example.com/link">Here!</a>