Question about using NGINX proxy for the Stone Viewer - issue with 'upstream prematurely closed connection'

This doesn’t appear to have anything to do with Orthanc directly, except when running it behind an NGINX reverse proxy, especially with the Stone Viewer.

I am seeing error like this in the NGINX error.log when scrolling through a series. I changed my domain to domain.com to hide my domain, and I think http://172.20.0.11:8042 is the docker IP for the orthanc container. I’ve played around quite a bit with the nginx settings but have not been able to figure out what exactly the issue is. It actually does eventually load all of the instances even with the error messages. I see that there is a keepalive setting for orthanc.json as well as some other settings.

I will keep investigating, but just wondering if anyone else has encountered that kind of problem.

2022/06/21 23:12:55 [error] 23#23: *4000 upstream prematurely closed connection while reading response header from upstream, client: 172.20.0.1, server: domain.com request: “GET /pacs-2/dicom-web/studies/1.2.840.113619.2.474.3.1678379723.186.1654086051.877/series/1.2.840.113619.2.80.115660586.27904.1654110718.1.4.1/instances/1.2.840.113619.2.80.115660586.27904.1654110722.205/frames/1/rendered?window=40,400,linear HTTP/2.0”, upstream: “http://172.20.0.11:8042/dicom-web/studies/1.2.840.113619.2.474.3.1678379723.186.1654086051.877/series/1.2.840.113619.2.80.115660586.27904.1654110718.1.4.1/instances/1.2.840.113619.2.80.115660586.27904.1654110722.205/frames/1/rendered?window=40,400,linear”, host: “domain.com”, referrer: “https://domain.com/pacs-2/stone-webviewer/index.html?study=1.2.840.113619.2.474.3.1678379723.186.1654086051.877

Here is one possible answer on StackOverflow:
https://stackoverflow.com/a/48858256

Hey Stephen! What’s up? Orthanc is probably unable to respond the requests in time, so you could increase the timeouts on NGINX (proxy_read_timeout, proxy_connect_timeout). proxy_connect_timeout is the time that NGINX waits for the initial connection (meaning Orthanc got the request). proxy_read_timeout is the time that NGINX waits for the response (the time Orthanc takes to finish its processing and return something). This is a way to mitigate the problem.

A few questions:

  1. Do the Orthanc logs show something in verbose mode?
  2. How is your nginx.conf setup?
    By the way, since you are using Docker, you could load balance a few reader instances in order to improve those read-only operations.

A quarta-feira, 22 de junho de 2022 à(s) 09:02:29 UTC+1, s.jo...@gmail.com escreveu: