wasm_postpone_rewrite

The `wasm_postpone_rewrite` directive allows the postponement of rewrite processing until after WebAssembly filters have executed.

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

Description

The wasm_postpone_rewrite directive is a feature within NGINX that is used when working with the Proxy-Wasm module. By using this directive, you instruct NGINX to delay the application of any rewrite rules until after any WebAssembly-based filters have been executed. This can be particularly useful in scenarios where the logic behind the WebAssembly filter may determine the final rewrite behavior based on some runtime conditions or data processed by the filter.

This directive takes a single argument, which specifies the condition under which to postpone the rewrite. The expectation is that this would typically relate to interactions within the WebAssembly filter that might modify the request or response properties that are critical for accurate URL rewriting. It helps to align the flow of request processing with complex logic encapsulated in WebAssembly, particularly for advanced request processing requirements where the timing of rewrites is crucial.

When used in contexts such as http, server, or location, it allows for fine-tuning the request handling behavior at various levels of the server configuration. This provides admins with powerful tools to manage and shape request flows more dynamically, utilizing the flexibility offered by WebAssembly filters.

Config Example

http {
    server {
        listen 80;

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

Remember to ensure that your WebAssembly filters are properly handling all required logic before allowing rewrites to occur.

If wasm_postpone_rewrite is set but no actual WASM filter is executed, the rewrites will be postponed indefinitely, which may cause unexpected behavior.

← Back to all directives