API Key just shows a "-" (dash)

Hey all

I have Syncthing running behind an nginx reverse proxy. If I access the web ui via the reverse proxy, the API Key always just shows a “-” but if I access the web ui directly, I can see the correct API Key. Is that a bug or a feature? If so, can I still show the API Key somehow when using a reverse proxy?

Thanks for your help Roman

We don’t do anything special based on who or how the config is requested (and that is where the API key lives), so I’m not sure.

Strange. Is there some way I can debug this somehow?

Check chrome developer tools to see what comes back from the rest calls, and see if there are any errors.

Hmm in the config result I can see the correct api key. When loading the page, I get the following error when connecting via reverse proxy:

TypeError: Cannot read property 'user' of undefined
    at refreshNoAuthWarning (syncthingController.js:442)
    at syncthingController.js:423
    at angular.js:9452
    at processQueue (angular.js:13337)
    at angular.js:13353
    at Scope.$eval (angular.js:14589)
    at Scope.$digest (angular.js:14405)
    at Scope.$apply (angular.js:14694)
    at angular.js:14984
    at completeOutstandingRequest (angular.js:4959)

I don’t get that error when connecting directly.

Try clearing your browser cache

It seems that CSRF or something is failing so some request must not be returning, check the network tab.

It happens only in chrome, firefox works. Clearing the cache didn’t help. I only see http codes 200 or 304.

Might be a race condition, the check happens before the config is loaded somehow, but yeah, no idea, you are on your own.

I just saw that the error also happens when connecting without reverse proxy, but in that case, the api key is still filled. So this is something else.

It seems to be some kind of race issue but strange that it always happen behind a reverse proxy.

This probably isn’t of much help to you, but I also have the interface behind nginx and all is well on FF and Chrome.

But, I initially had repeated “Syncthing seems to be down” messages, until I adjusted some buffers and timeouts in my nginx config.

These are the relevant parts of my nginx config:

server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  server_name ...
  ssl_certificate ... etc
  location / {
      add_header Strict-Transport-Security "max-age=31536000";
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_buffers 32 4m;
      proxy_busy_buffers_size 25m;
      proxy_buffer_size 512k;
      proxy_read_timeout 600s;
      proxy_send_timeout 600s;
      proxy_http_version 1.1;
      proxy_max_temp_file_size 0;
      proxy_pass http://127.0.0.1:8384/;
  }
}