wasm_postpone_access

The `wasm_postpone_access` directive delays the execution of WebAssembly filters in the access phase until after the request body is available.

Syntaxwasm_postpone_access on | off;
Defaultoff
Contexthttp, server, location
Arguments1

Description

The wasm_postpone_access directive is part of the ngx_wasm module, which empowers NGINX to run WebAssembly (Wasm) code directly within its processing phases. By using this directive, the NGINX server can optimize requests that require access to the body of the HTTP request before applying certain application-level logic defined in the Wasm module. This can be particularly useful for use cases such as validating data formats or contents that depend on the request body, where typical access phase operations might not have access to this data.

When set, wasm_postpone_access tells NGINX to delay executing the configured Wasm filters until the request body has been received. This allows for a more refined control over the request flow by ensuring specific access checks or modification logic can be executed only when fully necessary. The directive can be configured in various contexts including http, server, or location.

This directive takes one argument, usually a boolean value indicating whether the postponement should be applied. This simplistic configuration approach ensures ease of use for administrators looking to enhance their NGINX configuration with sophisticated Wasm capabilities without deep diving into complex settings.

Config Example

http {
    server {
        listen 80;

        location / {
            wasm_postpone_access on;
            proxy_wasm my_filter;
            proxy_pass http://backend;
        }
    }
}

Ensure proper ordering of the directives; wasm_postpone_access must be defined before any proxy_wasm directives in the same context.

Using this directive without a corresponding Wasm filter that requires the body may lead to unnecessary complexity.

Not all filters may support operations if the body is not available by default, leading to runtime issues.

← Back to all directives