proxy_protocol_timeout
Sets the timeout for receiving a PROXY protocol header in the NGINX Stream module.
Description
The proxy_protocol_timeout directive specifies the maximum time limit for receiving a PROXY protocol header from a client in a stream server context. This directive is crucial for scenarios where the PROXY protocol is used to pass client connection details from a load balancer or reverse proxy to backend servers. If the specified timeout is reached before the complete header is received, the connection will be closed, ensuring that resources are not held indefinitely waiting for incomplete data.
The parameter for this directive is a time value that can be specified in seconds or in a time format such as '1s', '10m', '1h', etc. The timeout should be set thoughtfully to accommodate network variability while balancing resource allocation. A too-short timeout might lead to premature connection closures in environments with slower clients or high latency, while a longer timeout may increase resource consumption unnecessarily.
By configuring the proxy_protocol_timeout, server administrators can ensure that their stream applications robustly handle connection setups involving the PROXY protocol, enhancing both performance and user experience. This directive is commonly used in conjunction with other proxy protocol related configurations to optimize stream server behavior.
Config Example
stream {
server {
listen 1234;
proxy_protocol_timeout 5s;
}
}Make sure the specified timeout accounts for your network conditions; too short may disrupt legitimate connections.
This directive applies only to servers that use the PROXY protocol; ensure it's appropriately placed within such server blocks.