From 25f8d6c436fb05b7ce70ab00e3e235c658802c2f Mon Sep 17 00:00:00 2001 From: 3alpha <15694175+3alpha@users.noreply.github.com> Date: Wed, 16 Sep 2026 11:44:29 +0200 Subject: [PATCH] Relax proxy nginx limits for trusted internal network The proxy sits on the internal DAppNode Docker network with no untrusted clients, so the stock nginx defaults only get in the way: 1m body limit, 4k/8k header buffers, 60s timeouts and response buffering can truncate large validator queries, slow block publishes and the /eth/v1/events stream. Open everything up and hoist the shared directives into the http block, which also removes the duplicated proxy_set_header block in both servers. - client_max_body_size 0 (unlimited) - larger client/proxy header and body buffers - 1h client/proxy/send/keepalive timeouts - proxy_buffering and proxy_request_buffering off (SSE stays open) - proxy_ignore_client_abort on, proxy_socket_keepalive on - HTTP/1.1 with Connection "" for upstream keepalive - tcp_nodelay on, server_tokens off, worker tuning --- proxy/nginx.conf | 82 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 13 deletions(-) diff --git a/proxy/nginx.conf b/proxy/nginx.conf index 41dc8ae..4844181 100644 --- a/proxy/nginx.conf +++ b/proxy/nginx.conf @@ -1,21 +1,81 @@ -events {} +worker_processes auto; + +events { + worker_connections 8192; + multi_accept on; +} http { + # ------------------------------------------------------------------ + # Trusted environment (internal Docker network, no untrusted clients): + # everything is deliberately opened up so that large validator sets, + # long REST URLs and long-lived streams are never cut off. + # ------------------------------------------------------------------ + + # No request body limit (0 = unlimited). Block/attestation publishing + # and bulk validator imports go through here. + client_max_body_size 0; + client_body_buffer_size 1m; + + # Request line / header buffers: /eth/v1/beacon/states/head/validators/ + # and multi-pubkey queries easily blow past the 4k/8k defaults. + client_header_buffer_size 32k; + large_client_header_buffers 8 64k; + + # Generous timeouts for slow clients, large uploads and idle keepalive. + client_body_timeout 1h; + client_header_timeout 1h; + send_timeout 1h; + keepalive_timeout 1h; + keepalive_requests 100000; + lingering_time 30s; + reset_timedout_connection on; + + # Low-latency behaviour for the API. + tcp_nodelay on; + tcp_nopush off; + server_tokens off; + + # ------------------------------------------------------------------ + # Upstream proxying defaults (applies to every location below). + # ------------------------------------------------------------------ + proxy_http_version 1.1; + proxy_set_header Connection ""; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Port $server_port; + + proxy_connect_timeout 60s; + proxy_send_timeout 1h; + proxy_read_timeout 1h; + proxy_socket_keepalive on; + + # Stream everything: no buffering, so /eth/v1/events SSE stays open and + # large responses start flowing immediately instead of being spooled. + proxy_buffering off; + proxy_request_buffering off; + proxy_max_temp_file_size 0; + proxy_buffer_size 32k; + proxy_buffers 8 64k; + proxy_busy_buffers_size 128k; + chunked_transfer_encoding on; + + # Don't abort the upstream request if the client goes away (validator + # clients time out aggressively on block publish). + proxy_ignore_client_abort on; + server { listen 3500; + location /eth/v1/beacon/states/head/validators/ { proxy_pass ${BEACON_CHAIN_URL}/eth/v1/beacon/states/head/validators/; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; } + location / { proxy_pass ${VALIDATOR_URL}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; } } @@ -24,10 +84,6 @@ http { location / { proxy_pass ${BEACON_CHAIN_URL}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; } } }