To enable HomeAssistant usage with a reverse proxy under the following assumptions:
- The proxy server and HASS are both on the same physical host
- HomeAssistant is set up via Docker Compose and in host networking mode
- The proxy server is set up via Docker Compose and not in host networking mode
you will need to add the following to the configuration.yaml for HomeAssistant:
http:
use_x_forwarded_for: true
trusted_proxies:
- 172.18.0.0/16 # or whatever your proxy network isAdditionally, if you want HASS to be reachable only via proxy, add server_host: 127.0.0.1 to that http object.
See also
https://community.home-assistant.io/t/reverse-proxy-using-nginx/196954, step 9 in particular details this configuration entry
When you configure the proxy, you’ll need to configure it to route traffic to the external IP address of the whole host, not the HomeAssistant container. For example, routing from homeassistant.example.com to http://192.168.30.142:8123.
Voice preview
If you have a Voice Preview Edition, see also HASS Voice Preview and Reverse Proxies.