I want to set up an Apache reverse proxy for my Home-Assistant(hass) instance running in my local network.
I tunnelled the traffic of the local hass instance to a remote server with ssh -N [email protected] -R 8123:localhost:8123
.
Now I tried to set up a plain reverse proxy in Apache:
<VirtualHost *:443>
ServerName hass.example.com
SSLEngine On
# If you manage SSL certificates by yourself, these paths will differ.
SSLCertificateFile fullchain.pem
SSLCertificateKeyFile privkey.pem
SSLProxyEngine on
SSLProxyProtocol +TLSv1.2 +TLSv1.3
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
ProxyPreserveHost On
ProxyRequests Off
ProxyVia On
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
# Proxy all traffic to hass
ProxyPass / http://localhost:8123/ nocanon
ProxyPassReverse / http://localhost/
ErrorLog ${APACHE_LOG_DIR}/hass.example.com-error.log
CustomLog ${APACHE_LOG_DIR}/hass.example.com-access.log combined
<IfModule security2_module>
SecRuleEngine off
</IfModule>
</VirtualHost>
<VirtualHost *:80>
ServerName hass.example.com
Redirect permanent / "https://hass.example.com"
ErrorLog ${APACHE_LOG_DIR}/hass.example.com-error.log
CustomLog ${APACHE_LOG_DIR}/hass.example.com-access.log combined
</VirtualHost>
Sadly if I try to open hass.example.com
, the browser responds with 400: Bad Request
.