Steps to Enable SSLProxyEngine in Apache
SSLProxyEngine is required when Apache acts as a reverse proxy
and forwards requests to a backend that serves HTTPS. Without it, requests to
HTTPS backends fail with a 502 Proxy Error — the proxy simply refuses to
establish an SSL connection to the upstream server.
1. Open the Apache Configuration File
sudo nano /etc/apache2/sites-enabled/your-site.conf # Ubuntu/Debian
sudo nano /etc/httpd/conf/httpd.conf # CentOS/RHEL
2. Enable SSLProxyEngine
Add the following line inside the <VirtualHost> block that
contains your ProxyPass directives:
SSLProxyEngine on
Example with an HTTPS backend:
<VirtualHost *:443>
ServerName example.com
SSLProxyEngine on
ProxyPass / https://backend.internal:8443/
ProxyPassReverse / https://backend.internal:8443/
</VirtualHost>
3. Test and Reload Apache
sudo apachectl configtest
sudo systemctl reload apache2 # Ubuntu/Debian
sudo systemctl reload httpd # CentOS/RHEL
Run apachectl configtest before reloading — it reports syntax
errors without interrupting the running server.
Common Errors
- 502 Proxy Error when proxying to an HTTPS backend:
SSLProxyEngineis missing or themod_proxy_sslmodule is not loaded (sudo a2enmod proxy_sslon Debian/Ubuntu). - SSL certificate verification failures: for internal backends with self-signed certificates, set
SSLProxyVerify noneandSSLProxyCheckPeerCN off(only for trusted internal networks).