Hello there,
I am having problems setting up a reverse proxy on my home assistant installation. The weird part is that I have access to the login page and also seem to get authorized (because a refresh-token is genereated) when I log in but then I get the message:
Unable to connect to Home Assistant.
When I hit the refresh button then it just brings me back to the login screen. I am thinking that it might have something to do with ProxyPassReverse setting in the apache2 configuration of the proxy server but actually do not know what I am doing wrong.
My setup is as follows:
I have a domain with a CNAME DNS-record pointing at the DuckDNS address which points at my homes IP. The external port 80 and 443 are forwarded to the same internal ports of the server running the reverse proxy.
The reverse proxy server is running apache2 with the following config and the same for port 80:
<VirtualHost *:443>
ServerName home.example.org
ProxyPreserveHost On
ProxyRequests off
ProxyPass /api/websocket ws://localhost:8123/api/websocket
ProxyPassReverse /api/websocket ws://localhost:8123/api/websocket
ProxyPass / http://localhost:8123/
ProxyPassReverse / http://localhost:8123/
RewriteEngine on
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://localhost:8123/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) http://localhost:8123/$1 [P,L]
</VirtualHost>
A created a SLL certificate for the external domain using certbot.
My home assistant config is the following:
http:
base_url: external.domain.com
use_x_forwarded_for: true
trusted_proxies:
- proxy_server_ip_address
I hope someone can help me. Thanks in advance!