0

I'm using a dockerized nginx proxy server. I have a ReactJS app running on another container and have given the proxy pass redirect in the proxy server's nginx conf file. When I try to load the ReactJs with it's url on the browser, I'm getting a 504 connection timed out error.

This is the nginx proxy log file output:

[error] 31#31: *6 upstream timed out (110: Connection timed out) while reading response header from upstream, client: xx.xxx.xx.xx , server: backend.wybrid.com, request: "GET /js/vendor.js HTTP/1.1", upstream: "http://172.18.0.9:8000/js/vendor.js", host: "backend.wybrid.com", referrer: "http://backend.wybrid.com/"

This is the server block for the ReactJs app in the proxy server nginx conf file:

server {
   listen 80;
   server_name backend.wybrid.com;
   client_max_body_size 50M;
   location / {
      proxy_pass http://wybrid-ng:8000;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_buffering off;
   }
}

Additionally I've also tried using:

proxy_read_timeout 3600;

in the location block shown above. But this didn't seem to resolve the issue.

For some more info, when I inspect the page on a browser, I can see a couple of js files appearing in the sources tab but not exactly downloading the contents of those files.

adityabhuvanraj
  • 25
  • 1
  • 13
  • Running into same issue, were you able to find the root cause? – Ashay Fernandes Nov 16 '22 at 07:09
  • 1
    You could just try and reload the nginx proxy in the container, its sometimes because the docker network hasn't updated the ip of the target upstream container since maybe it was recreated or updated. So try reloading the nginx and try again. – adityabhuvanraj Nov 17 '22 at 08:35

1 Answers1

0

try these steps to resolve this issue

  1. Adjustment in timeout settings
  2. Modifying Other Nginx settings
  3. Modification in PHP settings
  4. Nginx virtual host configuration settings

refer this url for more info; https://bobcares.com/blog/504-timeout-nginx/

All the best