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.

1 Answer 1

4

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

AddOutputFilterByType SUBSTITUTE text/html 
1
  • Awesome, that saved my live although my links were almost correct http://example.com instead of https://example.com So I added AddOutputFilterByType SUBSTITUTE text/html Substitute "s|http://example.com/|https://example.com/|i" Commented Mar 9, 2024 at 19:38

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.