From 3827962be49440018458d0a25fc91bc6fa9f2e80 Mon Sep 17 00:00:00 2001 From: Gaetan Semet Date: Wed, 9 May 2018 09:54:42 +0200 Subject: [PATCH] synology reverse proxy: add template patch (#5316) * synology reverse proxy: add template patch instruction from orobardet/dsm-reverse-proxy-websocket works * Minor changes --- source/_docs/ecosystem/synology.markdown | 28 ++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/source/_docs/ecosystem/synology.markdown b/source/_docs/ecosystem/synology.markdown index c5c436da588..20cf14f98fb 100644 --- a/source/_docs/ecosystem/synology.markdown +++ b/source/_docs/ecosystem/synology.markdown @@ -10,13 +10,33 @@ footer: true redirect_from: /ecosystem/synology/ --- -Synology NAS are the perfect companion to running Home Assistant. +Synology NAS are the perfect companion to running Home Assistant. But by default, the DSM Reverse Proxy does not configure its NGINX settings to allow WebSocket, and some extra configuration will be required to get the Home Assistant frontend working with the DSM. -### {% linkable_title HTTP Configuration %} +### {% linkable_title Template change %} -Synology will require some extra configuration to get the Home Assistant frontend working. +To allow WebSocket by default for all service exposed by NGINX, you can enable it in the template file located in `/usr/syno/share/nginx/Portal.mustache`. Please be really careful in editing this file since you may break access to the DSM UI. Please backup this file before any edition. -- Copy the Home Assistant specific Reverse Proxy settings from the existing `/etc/nginx/app.d/server.ReverseProxy.conf` to `/usr/local/etc/nginx/conf.d/http.HomeAssistant.conf` +Open `/usr/syno/share/nginx/Portal.mustache` and add the followings in the `Location` section: + +``` + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_read_timeout 86400; +``` + +Then restart the NGINX daemon: + +```bash +sudo synoservicecfg --restart nginx +``` + +This will restart the running HTTP service, not only reverse proxy, as a single instance of NGINX runs everything. + +You can find more information [here](https://github.com/orobardet/dsm-reverse-proxy-websocket). + +#### {% linkable_title HTTP Configuration %} + +- Copy the Home Assistant specific Reverse Proxy settings from the existing `/etc/nginx/app.d/server.ReverseProxy.conf` file to `/usr/local/etc/nginx/conf.d/http.HomeAssistant.conf`. - Include these lines in the location declaration: ```