http2_max_field_size

The `http2_max_field_size` directive sets the maximum size of HTTP/2 header fields.

Syntaxhttp2_max_field_size size;
Defaultdefault is 16k;
Contexthttp, server
Arguments1

Description

The http2_max_field_size directive defines the maximum size of individual HTTP/2 header fields that the NGINX server will accept. This parameter is crucial for controlling the amount of data that can be sent in a single header field, which can help mitigate memory exhaustion attacks and ensure compliance with specific application requirements. The size limit is specified in bytes, and it directly affects how NGINX processes incoming requests and handles header fields.

When this directive is configured, if a header field exceeds the specified size limit, NGINX may reject the request with an error, thus providing a safeguard against overly large headers that could potentially be used for abuse. This can be particularly important in high-traffic environments where efficiency and reliability are paramount. Proper configuration of this directive allows system administrators to balance application performance and resource protection effectively.

To use the http2_max_field_size directive, you simply specify the maximum size you want to set in bytes when defining it within the http or server contexts of the NGINX configuration. This flexibility allows administrators to make adjustments based on their application needs, whether they are working with standard sizes or require larger sizes for specific use cases.

Config Example

http {
    http2_max_field_size 32k;
}

Setting the value too low may cause legitimate requests to fail if headers exceed the limit.

Keep in mind that this directive only applies to HTTP/2 connections.

← Back to all directives