srt_proxy_connect_timeout

The srt_proxy_connect_timeout directive sets the maximum time to wait for a connection to be established when proxying SRT streams.

Syntaxsrt_proxy_connect_timeout timeout_in_seconds;
Default60
Contextstream, stream server
Arguments1

Description

The srt_proxy_connect_timeout directive specifies the timeout for establishing a connection to the upstream server in the context of SRT (Secure Reliable Transport) proxying. When an SRT stream is being proxied, if the connection to the destination fails to establish within this specified timeout period, NGINX will stop attempting to connect and log an error. This is crucial in minimizing downtime and ensuring that NGINX does not hang indefinitely trying to reach an unreachable service. The argument for this directive is an integer that indicates the timeout in seconds.

This directive is primarily useful in scenarios where the backend SRT servers might be slow to respond or temporarily unavailable. Setting it to a reasonable value helps to prevent resource exhaustion on the NGINX side, allowing for timely failure handling and potentially alternative routing logic to be employed. Careful consideration should be given to the value set, as too short a timeout might lead to frequent connection errors under normal operation conditions, while too long a timeout might delay error handling during failures.

As part of good practices when using this directive, one should ensure to monitor the actual connection behaviors and adjust the timeout accordingly, as various network conditions and server performances can significantly impact connection establishment times.

Config Example

stream {
    server {
        listen 4321;
        srt_proxy_pass srt://127.0.0.1:5678;
        srt_proxy_connect_timeout 30;
    }
}

Setting the timeout too short might lead to frequent connection attempts failing even when the server is reachable but takes longer to respond.

If not set, the default timeout may lead to unexpected delays if the upstream server is slow to connect.

← Back to all directives