sxg_max_payload

The `sxg_max_payload` directive sets the maximum HTTP body size for which SXG generation is permitted in NGINX.

Syntaxsxg_max_payload size;
Default67108864
Contextserver
Arguments1

Description

The sxg_max_payload directive specifies the upper limit of the HTTP body size that the NGINX Signed HTTP Exchange (SXG) module will process. This allows server administrators to control resource usage by defining a threshold, beyond which requests cannot be converted into SXG format. It is particularly crucial as SXG aims to enhance loading speed for web applications by enabling efficient caching and delivery of signed exchanges. By enforcing a size limit, administrators mitigate the risk of excessive resource utilization and potential performance degradation.

This directive takes a single argument, which is a numeric value representing the maximum payload size in bytes. When the body of the incoming HTTP request exceeds the specified limit, NGINX will not generate the SXG, effectively bypassing the SXG processing for large requests. The default value is 67108864 bytes, which equals 64 MiB, a balance between accommodating typical web content sizes while keeping resource usage manageable. Consequently, tuning this parameter can depend on the server's capacity and the expected load from clients, ensuring that SXG remains a viable option without overwhelming system resources.

Config Example

server {
    listen 80;
    server_name example.com;

    sxg;
    sxg_certificate /path/to/certificate.pem;
    sxg_certificate_key /path/to/private.key;
    sxg_cert_url https://example.com/cert;
    sxg_max_payload 10000000;  # Set max payload size to 10 MiB
}

Ensure that the specified size does not exceed the maximum allowed by the server configuration or underlying operating system limits.

Setting the payload size too low might restrict the ability to serve larger content as SXG.

← Back to all directives