I don't know why the substitute directive is not working. The backend app that is behind the reverse proxy is Liferay and because it's generate absolute url, I have to make the substitution in the proxy. Moreover, I need to change the host name before the request is sent to the backend app.
Here's my 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>
The problem is I always get in the result (html) urls that points to site2.example.com. For example, I have: