Welcome! Log In Create A New Profile

Advanced

"502 Bad Gateway" on first request in a setup with Apache 2.4-servers as upstreams

July 15, 2016 01:22PM
The error I am getting in the logs:

"upstream prematurely closed connection while reading response header from upstream"

After the first request it works for 10-15 seconds without any problem.
According to tcpdump in the first request (the failing one) the upstream is receiving one GET and nothing more.

I found one workaround (https://hashnode.com/post/how-to-configure-nginx-to-hold-the-connections-and-retry-if-the-proxied-server-returns-502-cilngkof700iteq53ratetsry) which is adding the same upstream twice and adding the "backup"-option. The first request then fails but the second in all of my cases succeeds (checked via logs and tcpdump).

Any ideas (also some comments that could lead me to the solution would be helpful)?
Subject Author Posted

"502 Bad Gateway" on first request in a setup with Apache 2.4-servers as upstreams

maltris July 15, 2016 01:22PM

Re: "502 Bad Gateway" on first request in a setup with Apache 2.4-servers as upstreams

maltris September 13, 2016 02:13AM

Re: "502 Bad Gateway" on first request in a setup with Apache 2.4-servers as upstreams

hheiko September 13, 2016 03:15AM

Re: "502 Bad Gateway" on first request in a setup with Apache 2.4-servers as upstreams

maltris September 13, 2016 05:26AM

Re: "502 Bad Gateway" on first request in a setup with Apache 2.4-servers as upstreams

hheiko September 13, 2016 05:52AM

Re: "502 Bad Gateway" on first request in a setup with Apache 2.4-servers as upstreams

Anoop Alias September 13, 2016 06:06AM

Re: "502 Bad Gateway" on first request in a setup with Apache 2.4-servers as upstreams

hheiko September 13, 2016 07:25AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 66
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready