Recurring error when using nginx reverse proxy

Hi all,
I successfully installed Duplicati on my Debian 10 server and set up nginx to work as a reverse proxy to access the web interface from the outside. So far everything works fine but I get a recurring error which kinda floods my server log.

Mar 8, 2020 5:04 PM: Request for https://duplicati.my-custom-domain.tld/api/v1/serverstate/?lasteventid=9&longpoll=true&duration=299s gave error
System.AggregateException: One or more errors occurred. (Unable to write data to the transport connection: The socket has been shut down.) ---> System.IO.IOException: Unable to write data to the transport connection: The socket has been shut down. ---> System.Net.Sockets.SocketException: The socket has been shut down
  at System.Net.Sockets.Socket.Send (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.Net.Sockets.SocketFlags socketFlags) [0x0001a] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 
  at System.Net.Sockets.NetworkStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x000b4] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 
   --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x00107] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.<InnerWrite>m__0 () [0x00006] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 
  at System.Threading.Tasks.Task.InnerInvoke () [0x00012] in <d0e12f672b88444ab4b6d9b2ecf20142>:0 
  at System.Threading.Tasks.Task.Execute () [0x00000] in <d0e12f672b88444ab4b6d9b2ecf20142>:0 
--- End of stack trace from previous location where exception was thrown ---

  at Mono.Net.Security.MobileAuthenticatedStream.InnerWrite (System.Boolean sync, System.Threading.CancellationToken cancellationToken) [0x00100] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) [0x001c5] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 
  at Mono.Net.Security.AsyncProtocolRequest.StartOperation (System.Threading.CancellationToken cancellationToken) [0x000a4] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.StartOperation (Mono.Net.Security.MobileAuthenticatedStream+OperationType type, Mono.Net.Security.AsyncProtocolRequest asyncRequest, System.Threading.CancellationToken cancellationToken) [0x00314] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00014] in <d0e12f672b88444ab4b6d9b2ecf20142>:0 
  at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00052] in <d0e12f672b88444ab4b6d9b2ecf20142>:0 
  at System.Threading.Tasks.Task.Wait () [0x00000] in <d0e12f672b88444ab4b6d9b2ecf20142>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00019] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 
  at System.Net.Security.SslStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00006] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 
  at HttpServer.HttpClientContext.Send (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x00039] in <bed89f1655ee48029f6d6812f54c58ad>:0 
  at HttpServer.HttpResponse.Send () [0x0007f] in <bed89f1655ee48029f6d6812f54c58ad>:0 
  at Duplicati.Server.WebServer.BodyWriter.Dispose (System.Boolean disposing) [0x00029] in <c5f097a49c0a4f1fb0f93cf3f5f218b1>:0 
  at System.IO.TextWriter.Dispose () [0x00000] in <d0e12f672b88444ab4b6d9b2ecf20142>:0 
  at Duplicati.Server.WebServer.BodyWriter.WriteJsonObject (System.Object o) [0x00068] in <c5f097a49c0a4f1fb0f93cf3f5f218b1>:0 
  at Duplicati.Server.WebServer.BodyWriter.OutputOK (System.Object result) [0x00006] in <c5f097a49c0a4f1fb0f93cf3f5f218b1>:0 
  at (wrapper remoting-invoke-with-check) Duplicati.Server.WebServer.BodyWriter.OutputOK(object)
  at Duplicati.Server.WebServer.RESTMethods.RequestInfo.OutputOK (System.Object item) [0x00006] in <c5f097a49c0a4f1fb0f93cf3f5f218b1>:0 
  at Duplicati.Server.WebServer.RESTMethods.ServerState.GET (System.String key, Duplicati.Server.WebServer.RESTMethods.RequestInfo info) [0x0002a] in <c5f097a49c0a4f1fb0f93cf3f5f218b1>:0 
  at Duplicati.Server.WebServer.RESTHandler.DoProcess (Duplicati.Server.WebServer.RESTMethods.RequestInfo info, System.String method, System.String module, System.String key) [0x00146] in <c5f097a49c0a4f1fb0f93cf3f5f218b1>:0 
---> (Inner Exception #0) System.IO.IOException: Unable to write data to the transport connection: The socket has been shut down. ---> System.Net.Sockets.SocketException: The socket has been shut down
  at System.Net.Sockets.Socket.Send (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.Net.Sockets.SocketFlags socketFlags) [0x0001a] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 
  at System.Net.Sockets.NetworkStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x000b4] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 
   --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 size) [0x00107] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.<InnerWrite>m__0 () [0x00006] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 
  at System.Threading.Tasks.Task.InnerInvoke () [0x00012] in <d0e12f672b88444ab4b6d9b2ecf20142>:0 
  at System.Threading.Tasks.Task.Execute () [0x00000] in <d0e12f672b88444ab4b6d9b2ecf20142>:0 
--- End of stack trace from previous location where exception was thrown ---

  at Mono.Net.Security.MobileAuthenticatedStream.InnerWrite (System.Boolean sync, System.Threading.CancellationToken cancellationToken) [0x00100] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) [0x001c5] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 
  at Mono.Net.Security.AsyncProtocolRequest.StartOperation (System.Threading.CancellationToken cancellationToken) [0x000a4] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.StartOperation (Mono.Net.Security.MobileAuthenticatedStream+OperationType type, Mono.Net.Security.AsyncProtocolRequest asyncRequest, System.Threading.CancellationToken cancellationToken) [0x00314] in <a9a08e39ba304bd0a84c49bd158dfc02>:0 <---

I have tried to increase my webserver’s timeouts but to no avail.
My current nginx configuration looks like this.

server {
	listen 443 ssl http2;
	listen [::]:443 ssl http2;

	server_name duplicati.my-custom-domain.tld;

	# logging
	access_log /var/log/nginx/duplicati.my-custom-domain.tld/duplicati.my-custom-domain.tld.access.log;
	error_log /var/log/nginx/duplicati.my-custom-domain.tld/duplicati.my-custom-domain.tld.error.log warn;

	# reverse proxy
	location / {
		# proxy settings
		proxy_set_header Connection "Keep-Alive";
		proxy_set_header Proxy-Connection "Keep-Alive";
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto $scheme;
		proxy_http_version 1.1;
		proxy_read_timeout 600;
		proxy_connect_timeout 600;
		proxy_send_timeout 600;
		send_timeout 600;
		keepalive_timeout 600;
		proxy_pass https://127.0.0.1:8200;
	}
}

I use Duplicati version 2020-01-18 - 2.0.5.1_beta_2020-01-18 and nginx version 1.14.2.
It would be awesome if anyone could tell me what I missed to configure because the error messages drive me nuts.

Reverse Proxy on NGINX had a couple of ideas. Beyond that, I can’t help with NGINX configuration…