Skip to content

Commit

Permalink
Adjust more timeouts (#4264)
Browse files Browse the repository at this point in the history
* Adjust more timeouts

This change disables most NGINX timeout checks (e.g., client body, header, read timeouts)
and sets the keepalive timeout to a high value. The goal is to let the Go application
handle timeout configurations and prevent resource exhaustion on the NGINX side.
This approach is temporary until the Go application can be migrated away from `nicehttp`.

* increase instead of disabling
  • Loading branch information
jcscottiii authored Feb 13, 2025
1 parent dbca2b8 commit 1582508
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions webapp/web/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
# Adjust server wide timeouts
keepalive_timeout 65;
# Similar to the timeouts specifically for the Go server below
client_header_timeout 10m;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
Expand Down Expand Up @@ -73,6 +76,22 @@ http {
proxy_set_header X-Forwarded-Proto $scheme;
# Disable checking of the body size
client_max_body_size 0;
# Disable or increase timeout checks. Allow the application to determine the appropriate timeouts
client_body_timeout 0;
send_timeout 10m;
proxy_read_timeout 10m;
proxy_connect_timeout 10m;
# TODO(https://github.com/web-platform-tests/wpt.fyi/issues/4231)
# Nginx client keepalive timeout. Due to the use of nicehttp, the Go application's
# idle timeout is not configurable, and it defaults to no timeout as per Go 1.23.
# 10 minutes is a temporary high value until nicehttp can be replaced or configured.
# Consider reducing this timeout to a more reasonable value (e.g., 60s) to prevent
# excessive idle connections.
# IMPORTANT: The NGINX UPSTREAM keepalive timeout (configured in the upstream block)
# MUST be LESS than the Go application's idle timeout to avoid connection errors.
# However, since the Go application effectively has no timeout right now because of nicehttp,
# the upstream timeout must be set to a reasonably high value.
keepalive_timeout 10m;
}
}
}

0 comments on commit 1582508

Please sign in to comment.