I have a website running on a docker container, and I've created a VirtualHost on the host's apache that is doing a reverse proxy to the container (on host's 8280 port). So I have:

<VirtualHost *:443>
    ServerName www.example.com
    DirectoryIndex index.php index.html

    ProxyPass / http://localname:8280/
    ProxyPassReverse / http://localname:8280/

    Substitute "s|http://localname:8280/|https://www.example.com/|i"

    SSLEngine on
    SSLProtocol all -SSLv2
    SSLCertificateKeyFile /path-to/privkey.pem
    SSLCertificateFile /path-to/cert.pem
    SSLCertificateChainFile /path-to/chain.pem

    <Proxy *>
        Order deny,allow
        Allow from all
        Allow from localhost

<VirtualHost *:80>
    ServerName www.example.com
    ServerAlias www.example.com

    Redirect permanent / https://www.example.com/

Proxy works well, I have a response when writing www.example.com in the browser, but I have all the links pointing to http://localname:8280 (as shown in the browser console) and a mixed content error, that's why I've put the Substitute directive, but it is not working.

I am using configuration for mod_substitute from apache documentation.


But this is not working, anything changes. The docker container is based on bitnami/apache image with default configuration.

Any help would be appreciated.


Ok, I have found the answer by myself. You only have to add the following line over Substitute directive:

AddOutputFilterByType SUBSTITUTE text/html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.