Reverse Proxy from HTTP to HTTPS with Apache

The other day, I had problem accessing an HTTPS site from a Python script. Since I had no time to spend figuring out why (it was for a personal project anyway), I decided to make a reverse proxy using Apache. However, unlike the commonly setup reverse proxy, this one is to make an HTTPS site available as HTTP site.

This is what I needed to put in my Apache config.

<VirtualHost 127.0.0.1:12345>
    ...
    SSLProxyEngine On
    ProxyPass / https://that.secure.site/
    ProxyPassReverse / https://that.secure.site/
    ....
</VirtualHost>

I also had to enable mod_proxy and mod_ssl which can be done easily (on Debian based system) by running the following command

# a2enmod proxy ssl

Then reload or restart Apache

# service apache2 reload

The most important bit in the config above is SSLProxyEngine On. Without this the proxy would not work!