Search code examples
apachesslreverse-proxyvirtualhostproxypass

Apache ProxyPass HTTP does not work with SSL


I was trying to add cloudflare SSL certification to the website I host locally, and force HTTPS for all users.

Connecting to IP:80 works fine (from inside my network). IP:443 fails as it expects a SSL certificate. Accessing domainname.com tells me the site is secure, so the SSL certificate works. But whenever I access it this way, the proxy website doesn't, displaying the 'Apache2 Default Page'. Same with connecting to IP:80 outside the network, it fails to proxy pass.

This is the config file I have setup, and by running apachectl -S I checked that no other rules exist.

<VirtualHost *:80>
    ServerName name.com:80

    ProxyPreserveHost On
    ProxyPass / http://localhost:7000/
    ProxyPassReverse / http://localhost:7000/
</VirtualHost>


<VirtualHost *:443>
    ServerName name.com:443

    SSLEngine on
    SSLCertificateFile /etc/cloudflare/name.com.pem
    SSLCertificateKeyFile /etc/cloudflare/name.com.key

    ProxyPreserveHost On
    ProxyPass / http://localhost:7000/
    ProxyPassReverse / http://localhost:7000/
</VirtualHost>

Is this because I am trying to load an http website, even though it is local? And if this is true, how else can I solve this problem? I feel so close, thanks for the help.


Solution

  • I solved it, by switching to the default-ssl config file provided with Apache2, and removing my version the issue resolved itself. Not sure why it worked the second time I tried it but oh well.