Maxim Dounin
December 01, 2011 05:14AM
Hello!

On Thu, Dec 01, 2011 at 03:20:12AM -0500, lsdillard wrote:

> I have a configuration that uses nginx + unicorn + rails 3.1. I have a
> load balancer in front of this, and the health checks are failing
> because nginx is sending a 499 response when I try to use a rails page
> for the health check. I can see that the rails response was a 200 from
> the logs, but nginx turns this into a 499. I understand that this means
> the client closed the connection, but its idle timeout is 60 seconds,
> and the rails log shows consistent sub-1 second response times. There's
> a second, more frequent health check that just opens a TCP connection on
> port 80 and only validates that the connection was opened. When I use a
> static page (either from rails public directory or from another
> directory), everything's fine. I cannot figure out why nginx is sending
> this 499 response -- one page indicated it was because of not having the
> host in the request

The 499 response is never send, it's just as status for logs to
show that client closed connection before nginx was able to reply
anything.

You description suggests that load balancer uses half-closed tcp
connection for health checks (i.e. shuts down it's part of a tcp
connection after sending request). This will result in
499 for proxied requests, as nginx will detect connection close
from client and will terminate request. You may use

proxy_ignore_client_abort on;
# or fastcgi_ignore_client_abort, whatever you use

to prevent nginx from doing connection close checks. It will stop
it from detecting connection close from clients as well though, so
you may want to limit this setting to health checks only by adding
separate location for health checks.

Alternatively, you may want to fix your load balancer to keep
connection open, not half-closed.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

499 error

lsdillard December 01, 2011 03:20AM

Re: 499 error

Maxim Dounin December 01, 2011 05:14AM

Re: 499 error

lsdillard December 07, 2011 05:20PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 285
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready