I am wondering what is the current way of adding https to Home Assistant by nginx reverse proxy, and if such a config is even supposed to work…
Because recently I brought online a Home Assistant VM, that I run on a VMware ESXi host (way more powerfull machine that a RPi), and I needed to be able to go through HTTPS to talk to it from outside my home network.
Found a couple of good resources here, in the forums, but I can’t make it work, for some reason.
Anyone with a recent enough install of HA and nginx as reverse SSL proxy?
I am running the nginx reverse proxy on another VM, but when I try to log in I get to type my credentials, but then an error appears, saying that something went wrong, and I can hit retry.
I watched to logs of nginx and I could see the requests going through, but HA did not like something about the fact that the communication was not direct, or so it seems…
It turns out that @greengolfer showed what was incorrect/missing from my nginx config - now all is fine, and I can access my Home Assistant setup from outside using secure connection.
I also need a little help here. I have Hassio OS in my local network, and on the same network I have a machine, which is connected to VPN network. This machine is accessible through VPN and my idea is to also use it as Nginx reverse proxy. So, my Hassio OS will be accessible through that VPN network.
So, to clarify:
my LAN is 192.168.178.0/24
Hassio OS machine has IP: 192.168.178.200
VPN machine has LAN IP: 192.168.178.150, VPN IP: 10.10.8.2
I would like to access my Hassio through http://10.10.8.2/ha when I am on VPN.
I am also having the same issue. Running nginx on my router trying to proxy to HA. I am able to proxy to other servers on my network but I believe HA is blocking access due to the reverse proxy.
Having the same challenge. I have tried using location /ha/ and also setting a trailing slash after the port e.g. ```
proxy_pass http://192.168.178.200:8123/;
``
This at least lets the logo show, doesn’t do anything else though, also there doesn’t seem to be way to get the additonal ‘location /api/websockets’ section to work either. I would prefer to not have to create a new fqdn for the HA server proxy for the purposes of installing ssl certificates.
To reiterate once agian - I wanted to expose HomeAssistant outside of my home network via SSL.
To achieve this, on my LAN I run Home Assistant and a proxy machine. The proxy is then able to receive HTTPS requests on its IP/hostname if called like so:
I want to use reverse proxy with nginx proxy manager. Other way vpn. Reverse proxy is really safety? Still not sure if it’s a good idea to publish it on the internet
This directive sets the “Upgrade” header in the request being sent to the proxied server. The “Upgrade” header is used in HTTP for switching the connection to a different protocol, and it is commonly used with WebSocket connections.
$http_upgrade is an Nginx variable that contains the value of the “Upgrade” header from the client’s HTTP request. If the client’s request contains an “Upgrade” header, it will typically specify the protocol to upgrade to, such as “websocket.”
By setting this header, you are informing the proxied server that the client wants to upgrade the connection to a WebSocket or another protocol, allowing the server to respond accordingly.
proxy_set_header Connection $connection_upgrade;
This directive sets the “Connection” header in the request being sent to the proxied server. The “Connection” header indicates whether the client and server want to keep the connection open after the current request/response exchange.
$connection_upgrade is another Nginx variable that contains the value of the “Connection” header from the client’s HTTP request. If the client’s request contains a “Connection” header with the value “upgrade,” it signifies that the client wants to upgrade the connection to a different protocol, such as WebSocket.
By setting this header, you are indicating to the proxied server that the client intends to upgrade the connection.
These directives are commonly used when you are configuring Nginx as a reverse proxy for WebSocket applications. When a WebSocket connection is established, these headers are important for initiating the WebSocket handshake and ensuring that the connection is properly upgraded from a standard HTTP connection to a WebSocket connection.