I have router which is like “syncthing server”. All my PC at home is syncing with router.
I am also running some other services on router and those are accessible over local subdomain. For example service monitorix is accesible only over address “monitorix.router.local”
So I decide to do same config for syncthing. I dont want to access syncthing web gui over “IP_of_router:8384” but over address “syncthing.router.local”
I did read https://docs.syncthing.net/users/reverseproxy.html and https://docs.syncthing.net/users/guilisten.html
here is my nginx config
server {
listen 80;
listen [::]:80;
server_name syncthing.router.local;
allow 192.168.x.x/24;
deny all;
proxy_buffering off;
error_page 403 /custom_403.html;
location = /custom_403.html {
root /usr/share/nginx/html;
allow all;
}
location / {
proxy_set_header Host localhost;
proxy_pass http://localhost:8384;
}
}
I did change GUI Listen Address to 127.0.0.1:8384. Also add new DNS config to dnsmasq. And reload dnsmasq, nginx and syncthing.
I did get error : Host check error
After while I did find out that most important is line proxy_set_header Host localhost;
Documentation is saying proxy_set_header Host $host;.
We dont want to past hostname of client to syncthing but hostname of “localhost” because web gui is accessible only from same computer. I am not sure, but I will somehow update docs to mentioned that.