Home Assistant Behind a Synology Reverse Proxy

Home Assistant Behind a Synology Reverse Proxy

Documentation: https://www.home-assistant.io/integrations/http#use_x_forwarded_for

When using a reverse proxy with Home Assistant, you will need to enable the use_x_forwarded_for and 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:

  1. Go to Control Panel > Login Portal > Advanced > Reverse Proxy.
  2. 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)

Note:

  • Click WebSocket from the Create drop-down menu to fast create WebSocket function header to let reverse proxy support WebSocket.
  1. 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.