js_fetch_trusted_certificate

The `js_fetch_trusted_certificate` directive configures NGINX to fetch a trusted certificate using a JavaScript handler.

Syntaxjs_fetch_trusted_certificate handler_name;
Defaultnone
Contextstream, stream server
Arguments1

Description

The js_fetch_trusted_certificate directive allows integration with JavaScript to handle the retrieval of trusted certificates when serving requests under the stream context. This directive is particularly useful in environments that require dynamic certificate handling, such as when certificates are fetched based on application logic or external API calls. By using a JavaScript function to define the logic for retrieving the certificate, administrators can implement complex behavior that goes beyond static configurations. The JavaScript handler is expected to process and respond with the necessary certificate data, effectively enabling more flexible and secure handling of connections. This directive enhances the default TLS/SSL handling capabilities of NGINX by allowing runtime customization.

Config Example

stream {
    server {
        js_fetch_trusted_certificate fetch_cert_handler;
        listen 443 ssl;
        ... // other configurations
    }
}

Ensure the JavaScript handler correctly returns a valid certificate; otherwise, connections may fail.

Verify that the JavaScript execution context is properly set up to handle the calls made by this directive.

← Back to all directives