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

hheiko nginx-forum at forum.nginx.org
Tue Sep 13 11:25:13 UTC 2016

I've played with proxy timeout settings, no luck. And nothing was logged on
the backend-server.

Finally I've found something in the firewall log:

May 27 10:25:06 APZRP01 kernel: DROP: IN=APZRP01 OUT=
MAC=c4:34:6b:af:19:64:e8:65:49:28:08:77:08:00 SRC=
DST= LEN=40 TOS=0x00 PREC=0x00 TTL=128 ID=24114 DF PROTO=TCP

disabling iptables and changing to firewalld on centos - nothing changed.
Searching on google for this problem brings up some reports for this
behaviour, but not a solution. The problem is easy to reproduce, start nginx
proxy, access the upstream - no problem. wait an hour,...

2016/05/26 23:35:32 [error] 4908#5116: *27528 upstream timed out (10060: A
connection attempt failed because the connected party did not properly
respond after a period of time, or established connection failed because
connected host has failed to respond) while reading response header from

after a few seconds the backend responds again perfectly for hours, but
after a time of no traffic the problem occurs again, with 10 and 60 seconds
on the proxy_timeout

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,268306,269514#msg-269514

More information about the nginx mailing list