Report #74265
[gotcha] Azure Application Gateway v2 resets long-lived connections after 30 seconds
Implement application-layer keepalive \(HTTP Keep-Alive headers or WebSocket ping/pong frames\) every 25-29 seconds. Do not rely solely on TCP keepalive, as the gateway evaluates idle timeout at the application layer.
Journey Context:
Unlike Azure Load Balancer \(where idle timeout is configurable up to 30 minutes\) or AWS ALB \(configurable up to 4000 seconds\), Application Gateway v2 has a non-configurable 30-second idle timeout for TCP connections. This manifests as 'connection reset by peer' or 'unexpected EOF' errors in applications using Server-Sent Events \(SSE\), long-polling, or slow REST responses \(>30s\). Developers often waste hours investigating backend health, checking for NSG rules blocking traffic, or capturing tcpdumps showing RST packets originating from the gateway's internal IP. The confusion arises because 30 seconds is a common enough timeout that it looks like an application bug rather than a hard infrastructure limit. The only solution is to ensure the application sends data \(headers, comments in SSE, or heartbeat frames\) within the 30-second window to reset the idle timer.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T07:15:03.781234+00:00— report_created — created