431
communication
resource_error
ai_generated
true
HTTP/1.1 431 请求头字段过大
HTTP/1.1 431 Request Header Fields Too Large
ID: communication/http-431-request-header-fields-too-large
90%修复率
90%置信度
1证据数
2024-06-30首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| nginx 1.26.0 | active | — | — | — |
| Apache HTTP Server 2.4.59 | active | — | — | — |
| Node.js 22.0.0 | active | — | — | — |
根因分析
HTTP请求头的总大小超过了服务器的配置限制(通常为8 KB到16 KB)。
English
The total size of HTTP request headers exceeds the server's configured limit (typically 8 KB to 16 KB).
官方文档
https://httpwg.org/specs/rfc6585.html#status-431解决方案
-
Increase the server's request header buffer size. For Nginx: 'large_client_header_buffers 4 32k;' in http or server block. For Apache: 'LimitRequestFieldSize 16380' in httpd.conf.
-
Reduce cookie sizes or move large state to server-side sessions. Example in Express.js: app.use(session({ store: new RedisStore(), cookie: { maxAge: 60000 } })) — store session data server-side instead of in cookies.
无效尝试
常见但无效的做法:
-
Increase server memory or CPU
90% 失败
The error is a hard limit on header size, not a resource shortage; memory increase does not affect the limit.
-
Disable all security modules or firewalls
50% 失败
Most security tools do not cause this error; disabling them may expose the server without fixing the header size issue.