I get a 499 error after 60s whatever the config I try. I use Docker on a 8 core/32GB server and there is another nginx/lets-encrypt reverse proxy in front for the others containers. I am more on the dev side of the craft. I suppose I need to run my batch in background and I am going to explore that if I can't fix this, but I need to understand this error.

gunicorn worker seems to run after the error :

[2019-06-01 17:49:31 +0000] [1] [INFO] Listening at: (1)
[2019-06-01 17:49:31 +0000] [1] [INFO] Using worker: threads
[2019-06-01 17:49:31 +0000] [9] [INFO] Booting worker with pid: 9
[2019-06-01 17:49:31 +0000] [10] [INFO] Booting worker with pid: 10
[2019-06-01 17:49:31 +0000] [11] [INFO] Booting worker with pid: 11
[2019-06-01 17:49:31 +0000] [12] [INFO] Booting worker with pid: 12
[2019-06-01 17:49:31 +0000] [13] [INFO] Booting worker with pid: 13
[2019-06-01 17:49:31 +0000] [14] [INFO] Booting worker with pid: 14
[2019-06-01 17:49:31 +0000] [15] [INFO] Booting worker with pid: 15
[2019-06-01 17:49:31 +0000] [16] [INFO] Booting worker with pid: 16

nginx version: nginx/1.15.12

gunicorn 19.9.0

Django 2.2.1

conf nginx

upstream cobalt {
  server cobalt:8000;

# Catch all requests with an invalid HOST header
server {
    server_name "";
    listen      8000;
    return      444;

# portal
server {
    listen 8000;
    server_name xxxxxxxx;

    location / {
        proxy_set_header Host $host;
        proxy_pass http://cobalt;
        proxy_set_header X-Forwarded-Host $server_name;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Connection "";
        proxy_connect_timeout 1200s;
        proxy_read_timeout 1200s;
        proxy_send_timeout 1200s;
        client_max_body_size 100M;
        client_body_buffer_size 100M;
        client_body_timeout 1200s;
        keepalive_timeout 1200s;
        send_timeout 1200s;
        uwsgi_read_timeout 1200s;

    location /static/ {
        autoindex on;
        alias /static/;

    location /private-x-accel-redirect/ {
        alias   /media/;


conf gunicorn

"""gunicorn WSGI server configuration."""
bind = ''
timeout = 1200
workers = 8
threads = 2
  • 1
    499 means client disconnected. You can’t fix it with you timeout settings. Provably you should change your software to return something. If it’s really time consuming thing consider to return job id and have some means to check results using this id – Alexey Ten Jun 2 at 10:43
  • Check out this stackoverflow.com/questions/12973304/nginx-499-error-codes hope this will help. – asktyagi Jun 2 at 11:38
  • I already check that post, I am aware of "client closed the connection " but I don't thing my client (django) closed the connection but just don't throw anything to nginx, it's why I tried to get nginx wait a bit longer, I tried every timout settings, I thing, but after 60s I get the 499 stuff. It's why I ask the question here, the webDev answer would be " Why the hell your app is not responding to a client request under 60s !". I know the solution is some celery/redis stuff but after 2 days on this 60s/499 I want to find the solution. – Patrick Aymar Jun 2 at 15:50
  • If Django is your client, you should configure timeouts on django's side. – Alexey Ten Jun 3 at 7:17
  • Sorry I dont' get you, what's the django's timeout you are talking about ?, Django continue during several minutes and finish is task after the 60s/499 of nginx, fortunatly nginx don't kill the gunicorn workers after 60s. The " client closed the connection " seems dubious at best in my case, I'm pretty sure django doesn't do that, maybe gunicorn but why. – Patrick Aymar Jun 4 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.