proxy_requests

The proxy_requests directive controls whether NGINX can process incoming proxy requests in the stream module.

Syntaxproxy_requests on | off;
Defaultoff
Contextstream, stream server
Arguments1

Description

The proxy_requests directive is utilized within the NGINX Stream module to facilitate forwarding stream connections to upstream servers, enabling NGINX to act as a reverse proxy for TCP and UDP traffic. This directive allows administrators to specify if proxy requests should be accepted for the designated stream server block. When enabled, NGINX can handle sessions by maintaining connection states and allows communication between the client and the upstream server through the configured stream proxy settings.

This directive takes one argument, which can be set to either off or on. Setting it to on allows NGINX to process incoming requests as proxy requests, while off disables this feature, effectively terminating any incoming connections without proxying. Usage of this directive requires consideration of application behavior, as using it incorrectly can lead to unexpected connection closures or service inaccessibility if a connection attempt is made when proxying is disabled.

In practice, the use of proxy_requests must be carefully aligned with other stream directives to ensure proper flow and routing of network requests. For instance, when combined with proxy_pass directives, it can streamline complex networking scenarios wherein multiple upstream servers are involved in maintaining user sessions or data streams.

Config Example

stream {
    server {
        listen 1234;
        proxy_requests on;
        proxy_pass backend_servers;
    }
}

Using proxy_requests off; can unintentionally block valid proxy requests, leading to connection termination.

Ensure that this directive is set within the correct context (i.e., 'stream' or 'stream server'), as using it in other contexts will lead to configuration errors.

← Back to all directives