resolver_add

The resolver_add directive allows for adding DNS resolver addresses to a specified set within the NGINX Proxy-Wasm module context.

Syntaxresolver_add address resolver_name;
Defaultnone
Contexthttp, server, location
Arguments2

Description

The resolver_add directive is integral to the Proxy-Wasm module for NGINX, specifically for scenarios that require dynamic DNS resolution. This directive permits the configuration of multiple DNS resolver addresses, which are used by WebAssembly filters during their execution. By specifying these resolvers, you can ensure that your WASM modules can resolve hostnames dynamically, thereby enhancing the capabilities of your HTTP server or proxy.

Each resolver address added by the resolver_add directive will be utilized depending on the context. The directive facilitates operations such as hostname resolution for outgoing proxy requests or processing client requests that involve backend services identified by domain names. The flexibility it provides is particularly crucial in modern application architectures where microservices may change dynamically, and effective name resolution can be necessary for routing decisions or service communication.

The directive accepts two parameters: the address of the resolver, typically given in a format valid for a DNS server (like an IP address), and an optional parameter that specifies a valid resolver name. Understanding how to structure these parameters is key for proper configuration and ensuring that your WebAssembly modules can resolve required addresses efficiently during their processing phases.

Config Example

http {
    resolver 8.8.8.8 valid=30s; 
    resolver_add 8.8.4.4 additional_resolver;
}

Ensure that the resolver addresses are reachable by the NGINX server; otherwise, name resolution will fail.

Misconfiguration of DNS resolver names can lead to unexpected behavior in WebAssembly module resolutions.

Adding a resolver without first specifying a primary resolver can lead to confusion in resolution priorities.

← Back to all directives