7

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
    SetOutputFilter SUBSTITUTE,DEFLATE

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

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

    SSLEngine on
    SSLProtocol all -SSLv2
    SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
    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
    </Proxy>
</VirtualHost>

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

    Redirect permanent / https://www.example.com/
</VirtualHost>

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.

https://httpd.apache.org/docs/2.4/mod/mod_substitute.html

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

Any help would be appreciated.

3

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.