When using a reverse proxy with Home Assistant, you will need to enable the
trusted_proxies options in the configuration.yaml. Requests from reverse proxies will be blocked if these options are not set.
http: use_x_forwarded_for: true trusted_proxies: - 192.168.1.200 # Add the IP address of the proxy server - 172.30.33.0/24 # You may also provide the subnet mask
To set up Synology DSM reverse proxy rules:
- Go to Control Panel > Login Portal > Advanced > Reverse Proxy.
- Click Create and specify the following settings in the General page:
- Description: Specify a name that helps you identify the rule function.
- Specify the rules for the Source (the device sending requests from the Internet) and Destination (the device in the local network):
- Protocol: The HTTP or HTTPS protocols used by the source/destination
- Hostname: The name or IP Address of the Home Assistant device
- Port: The port used by Home Assistant (Port 8123 by default)
- Enable HSTS and Enable HTTP/2 (only for the source)
- Click WebSocket from the Create drop-down menu to fast create WebSocket function header to let reverse proxy support WebSocket.
- To adjust reverse proxy's other behavior, please go to Advanced Settings page.
- Proxy connection timeout (sec.): Set the proxy time limit of connection to target server.
- Proxy send timeout (sec.): Set the proxy time limit of request being sent to target server.
- Proxy read timeout (sec.): Set the proxy time limit of waiting for target server to response.
- Proxy HTTP version: Select the HTTP version that is used to communicate between proxy server and target server.
- Use the error page sent back by target server: When target server sending back error HTTP code, it will show target server's web error page after this option is ticked. Otherwise, it will show Synology NAS error page.
Click SAVE to save the settings.