Hi,
I have now been following along a bunch of tutorials on how to setup apache reverse proxy for HA. I have not succeeded with any config and was hoping to get some help from you, the experts, as you have got it running as is evident from other threads. I have also tried the official setup which has not yielded a successful outcome.
My setup is as follows:
I have home assistant installed on my ubuntu server running in a docker container. I have a reverser proxy configuration using apache2. This is all working. I can access my websites, services and home assistant from my local network (home assistant via ip and port). I can also access everything EXCEPT home assistant from outside the network.
I am getting the login screen and will be redirected to /lovelace
where I am greeted with the message: Unable to connect to Home Assistant
followed by a retry button.
My configuration looks as follows:
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName example.com
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://127.0.0.1:8123
ProxyPassReverse / http://127.0.0.1:8123
ProxyPass /api/websocket ws://127.0.0.1:8123/api/websocket
ProxyPassReverse /api/websocket ws://127.0.0.1:8123/api/websocket
RewriteEngine on
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://127.0.0.1:8123/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) http://127.0.0.1:8123/$1 [P,L]
</VirtualHost>
I have also tried with *:80. Same result here. When checking the network tab in the browser dev tools I can see that a connection attempt is made to wss://example.com/api/websocket
. The resulting status code is 400. No matter what i try, this does not change. I have changes the redirects to wss istead of ws and I have also used this config:
<VirtualHost *:80>
ServerName homeassistant.adamoutler.com #MODIFY to your host name
ServerAdmin adamoutler@gmail.com #MODIFY to your email
RewriteEngine On
# This will enable the Rewrite capabilities
RewriteCond %{HTTPS} !=on
# This checks to make sure the connection is not already HTTPS
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
#Declare server
ServerName homeassistant.adamoutler.com #MODIFY to your host name
ServerAdmin adamoutler@gmail.com #MODIFY to your email
#fix detecting incorrect login IP by proxy server
RemoteIPInternalProxy 192.168.1.1 #MODIFY to your proxy, or delete if you aren't using a firewall
RemoteIPHeader X-Forwarded-For
#proxy server setup
ProxyPreserveHost On
ProxyRequests Off
ProxyPass /api/websocket ws://192.168.1.8:8123/api/websocket #MODIFY to your HA IP:Port
ProxyPassReverse /api/websocket wss://192.168.1.8:8123/api/websocket #MODIFY to your HA:Port
ProxyPass / http://192.168.1.8:8123/ #MODIFY to your HA IP:Port
ProxyPassReverse / http://192.168.1.8:8123/ #MODIFY to your HA IP:Port
#fix websockets for addons and apis
RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteRule ^/?(.*) "ws://192.168.1.8:8123/$1" [P,L] #MODIFY to your HA IP address
#Set security on certan areas(some redacted)
<Location "/">
Satisfy any
# Include /path/to/mySecuritySettings.conf
</Location>
<Location "/api">
Satisfy any
</Location>
#HTTPS certs
# Include /path/to/sites-available/ssl.conf
# Include /path/to/options-ssl-apache.conf
# SSLProxyEngine On
# SSLCertificateFile /path/to/my-chain.pem
# SSLCertificateKeyFile /path/to/my-cert.pem
</VirtualHost>
</IfModule>
with no success. I of course adapted it to my server.
I have also enabled all the modules for apache that are required but still cannot get a connection. And yes, I also restarted the server everytime I made a change.
Can anyone tell me what I am missing or maybe just a tip where to look next?
Thank you for your help!
1 post - 1 participant