• Register
0 votes

Problem :

Currently I am using the nginx and node server to serve the update requests. I often face the gateway timeout whenever I request an update on large data. I saw below error from the nginx error logs as below :

2019/04/07 00:46:04 [error] 28599#0: *1 upstream prematurely closed connection while reading response header from upstream, client:, server: gis.oneconcern.com, request: "GET /update_mbtiles/atlas19891018000415 HTTP/1.1", upstream: "", host: "gis.oneconcern.com"

I tried everything that I could, but I still I face the same error.

The nginx configuration has below proxy settings :


    # Proxy settings


    proxy_connect_timeout 1000;

    proxy_send_timeout 1000;

    proxy_read_timeout 1000;

    send_timeout 1000;


I am trying to use the nodejs backend to serve the requests on an aws server. My gateway error shows up only when a update takes the long time around 3-4 minutes. Please note I do not get the error for smaller updates. Please let me know how can I resolve the issue.

6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I also had the same error for quite a while in recent past, and below is what fixed it for me.

I just declared in service that i use what is given below :

Description= The node service description

After= network.target






WorkingDirectory=/path/to/your /node/app/root/directory

ExecStart=/path/to/your/node /path/to/server.js



Please note "After=network.target". I spent many days looking for the fixes on nginx side, while my problem was just that. To be very sure just stop running the node service you have and  launch the ExecStart command directly and try to just reproduce the bug. If it does not show up, it clearly means that your service has all the problems. This is how I found my answer.

9 7 4
38,600 points

Related questions

0 votes
1 answer 13 views
Problem: I get an error in the Nginx log: upstream timed out (110: Connection timed out) while reading response header from upstream
asked Mar 15 ummesalma 21.3k points
0 votes
1 answer 992 views
Problem : My Environment is Nginx + uwsgi and I am very new to it. I am getting a 502 bad gateway error from Nginx on certain GET requests. It seems to be related to a length of URL.. Please find below the nginx/error.log [error] 22113#0: *1 recv ... response header from upstream, client:, server: server.domain.com, request: "GET <long_url_here>" Can somebody solve this issue?
asked Nov 27, 2019 alecxe 7.5k points
0 votes
1 answer 30 views
Problem: fastcgi sent in stderr: "primary script unknown" while reading response header from upstream,
asked Feb 19 Lucky Guy 1.5k points
0 votes
1 answer 6 views
Problem: 414 request-uri too large nginx. How to solve this error..
asked Mar 21 charles mathews 5.5k points
0 votes
1 answer 464 views
Problem : I want to set up the hello world example with AWS lambda and serving it through the api gateway. I clicked a "Create a Lambda Function", which set up a api gatway and selected a Blank Function option. I added a lambda function found on AWS ... response { "message": "Internal server error" }. And my logs say "Execution failed due to configuration error: Malformed Lambda proxy response".
asked Jan 22, 2020 jwilliam 3.9k points
0 votes
1 answer 6 views
Problem: the Error is npm ERR! **Unexpected end of JSON input while parsing near '...nt-webpack-plugin":"0'**
asked Mar 16 ummesalma 21.3k points
0 votes
1 answer 16 views
Problem npm err! unexpected end of json input while parsing near.
asked Feb 24 Dan phillip 4k points
1 vote
1 answer 6 views
Problem: Is some body here to tell me why I am getting this warning? You configured http(80) on the standard https(443) port!.
asked Mar 26 PkGuy 13.1k points
0 votes
1 answer 96 views
Problem: Facing this error message: Unchecked runtime.lasterror: could not establish connection. receiving end does not exist.
asked Mar 14 Wafa Abu Yousef 6.1k points
0 votes
1 answer 2K views
Problem : I had recently uninstalled the Postgres10 and after that reinstalled the Postgres10. After that I went to run a Node, Express, React application that relies on connecting to a Postgres10 database and also communicates with it using Sequelize. Initially I was unable to ... app at in the browser. Does anyone have any idea what is going wrong? Please suggest me the solution for my error.
asked Nov 22, 2019 peterlaw 6.9k points