how to make nginx loadbalancer give 404 when all upstream servers are down
Francis Daly
francis at daoine.org
Fri Aug 14 07:54:33 UTC 2015
On Fri, Aug 14, 2015 at 02:06:29AM -0400, karkunpavan wrote:
Hi there,
> Thanks for taking a look. With it curl behaves as expected, but with tools
> like ab and httperf, I am not seeing bad gateway responses when both the
> upstream servers are down.
> ab:
>
> When one upstream server is up:
>
> nginx console:
> <<client_IP>> - - [14/Aug/2015:13:44:57 +0000] "GET / HTTP/1.0" 200 45 "-"
> "ApacheBench/2.3"
Response status 200, content size 45.
> When both upstream servers are down:
>
> <<client_IP>> - - [14/Aug/2015:13:43:45 +0000] "GET / HTTP/1.0" 502 172 "-"
> "ApacheBench/2.3"
Response status 502, content size 172.
> as a result in bith cases ab just shows all successful responses:
> # ab -n 1 -c 1 http://<nginx_IP>:<port>/
> Server Port: 9000
> Complete requests: 1
> Failed requests: 0
> HTML transferred: 45 bytes
One request, 45 bytes of content. That is the "success" case.
If the "fail" case shows the same, while the nginx logs show something
else, then your testing tool is wrong.
> Any suggestions what I might be doing wrong?
ab is talking to port 9000.
Your previous config showed nginx listening on port 8000.
Might that be related?
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list