ngx_link_func_subrequest

The ngx_link_func_subrequest directive facilitates the invocation of subrequests within NGINX with configurable options.

Syntaxngx_link_func_subrequest flag;
Defaultnone
Contextserver, location
Arguments1+

Description

The ngx_link_func_subrequest directive allows users to trigger subrequests to specified URIs while providing additional control over how these requests are handled. This directive can take one or more arguments, which are used to specify flags that dictate the behavior of the subrequest. The available flags include check_status, which makes the server wait for the response before proceeding; incl_body, which enables the inclusion of the body of the request in the subrequest; and incl_args, which allows for the inclusion of arguments in the subrequest process. This flexibility is particularly useful for developers who want to dynamically link server responses to their applications using the NGINX server architecture.

When configured, the directive ensures that the subrequest is executed in the context of the NGINX server, giving developers the ability to control not only the invocation of backend applications but also how data is passed to and responses are handled from those applications. Using this directive effectively can enhance application performance and enable more complex workflows, such as aggregating responses from multiple application calls within a single NGINX request flow.

Config Example

location /example {
    ngx_link_func_subrequest incl_body incl_args;
}

Using multiple flags incorrectly can lead to unexpected behaviors.

Ensure that the application linked with this directive is properly compiled and accessible by NGINX.

Configuration errors may cause NGINX to fail to start or reload.

← Back to all directives