Apache2 reverse proxy HTTPS to HTTPS

Enable the Apache proxy module:

# a2enmod proxy_http

Use the following config to proxy HTTPS to HTTPS:

<VirtualHost *:443>

ServerName yourdomain

ProxyPreserveHost On
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
ProxyPass / https://destdomain/
ProxyPassReverse / https://destdomain/

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

SSLCertificateFile /etc/letsencrypt/live/yourdomain/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/yourdomain/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf

</VirtualHost>

Restart apache and you’re ready to go!

Leave a Reply

Your email address will not be published. Required fields are marked *