I have a service working on AWS-ECS with two tasks: one for uswgi and one for nginx. With uswgi I'm serving an API which sometimes needs more than 60s to process. For thar processes longer than 60s I get a timeout error as response. I tried to increase the timeout both in the nginx configuration and in the target group of AWS-ELB, but nothing is working... This is my configuration:
server {
listen ${LISTEN_PORT};
client_header_timeout 600s;
client_body_timeout 600s;
uwsgi_read_timeout 600s;
proxy_read_timeout 600;
proxy_connect_timeout 600;
proxy_send_timeout 600;
location /static {
alias /vol/static;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PATCH, OPTIONS, HEAD, DELETE';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
}
location / {
uwsgi_pass ${APP_HOST}:${APP_PORT};
include /etc/nginx/uwsgi_params;
client_max_body_size 300M;
client_body_buffer_size 300M;
client_body_timeout 600s;
uwsgi_read_timeout 600s;
}
location /elb-status {
access_log off;
client_body_timeout 600s;
uwsgi_read_timeout 600s;
return 200;
}
}
And the health checks in the target group in AWS-EBL:
- Unhealthy threshold: 2 consecutive health check failures
- Timeout: 5 seconds
- Interval: 100 seconds
- Success codes: 200
It's weird because the process keeps running after the timeout response and I don't get any error in nginx logs or on the target group monitoring section. I'm sure I'm missing something because the timeout error is displayed exactly at 1 minute, check the response from the frontend:
The health check timeout just handles the timeout for health check requests. I assume your health-check endpoint isn't the endpoint that needs more than 60 seconds to process a request. You need to modify the Connection Idle Timeout value in the load balancer's settings.