Syncthing not working on a Raspberry PI behind an nginx reverse proxy

Include required information

  • cat /etc/os-release
    PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
    NAME="Raspbian GNU/Linux"
    VERSION_ID="10"
    VERSION="10 (buster)"
    VERSION_CODENAME=buster
    ID=raspbian
    ID_LIKE=debian
    HOME_URL="http://www.raspbian.org/"
    SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
    BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
    
  • uname-r 5.10.17-v8+
  • syncthing -version syncthing v1.14.0 "Fermium Flea" (go1.16 linux-arm) deb@build.syncthing.net 2021-02-26 12:21:13 UTC [noupgrade]
  • Firefox 86

Nginx as reverse proxy

Because I have more services installed on the PI, I use Nginx as a reverse proxy.
This is the configuration

server {
        listen 80;
        listen [::]:80;
        server_name sync.thing;
        autoindex off;

        location / {
                allow 192.168.178.0/24;
                allow fd00::/32;
                expires max;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Forwarded-Port $server_port;
                proxy_set_header Host localhost;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_pass http://localhost:8384/;

                proxy_read_timeout 600s;
                proxy_send_timeout 600s;
                deny all;
        }

        location ~ \.php$ {
                deny all;
        }

        location ~ /\.ht {
                deny all;
        }
}

What happened?

  • I’m able to access the url http://sync.thing/.
  • It shows the expected page.
  • I was able to setup a connection to an other Syncthing node.
  • The choose folder was synced.
  • Suddenly the display of all information disappeard.
  • In the Devtools I see thousands of requests
  • When I open http://sync.thing/ in a private Browser tab everything works fine
  • But also in the private Browser tab there are thousands of requests to http://sync.thing/rest/events?since=19

It looks like the browser gets an immediate three bytes large response to that request. Syncthing doesn’t do that – it either takes a long time, as it waits for the next event to happen, or it contains an event object which is a lot larger than three bytes. So I’m not sure what’s happening here, perhaps looking at what the three bytes are might shed some light. Or perhaps the proxy logs. Maybe it’s caching. But it doesn’t look to me like a Syncthing problem.

Firefox says it contains []

Your expires max looks a bit suspicious. You can’t have your proxy add caching headings to responses, if that is what it means. That fits with the “aus cache” bit meaning the browser took that as a cache hit. Event responses should not be cached.

1 Like

You are absolutely right

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.