1. 給開發者的 Web 技術文件
  2. HTTP
  3. Reference
  4. HTTP 回應狀態碼
  5. 431 Request Header Fields Too Large

此頁面由社群從英文翻譯而來。了解更多並加入 MDN Web Docs 社群。

View in English Always switch to English

431 Request Header Fields Too Large

HTTP 431 Request Header Fields Too Large 用戶端錯誤回應狀態碼表示伺服器拒絕處理請求,因為請求的 HTTP 標頭過長。可以在減小請求標頭的大小後重新提交請求。

431 可以在請求標頭的總大小過大時使用,或者單個標頭字段過大時使用。為了幫助遇到此錯誤的用戶,請在回應主體中指示是哪一種問題——最好說出哪些標頭過大。這讓用戶可以嘗試解決問題,例如清除 cookie。

伺服器通常會生成此狀態:

狀態

http
431 Request Header Fields Too Large

範例

標頭欄位過大

在以下範例中,請求中的 Cookie 標頭過大:

http
GET /doc HTTP/1.1
Host: example.com
Cookie: cookie1=value1; cookie2=value2; cookie3=[...]

伺服器回應一則訊息,指示哪個標頭出現問題:

http
HTTP/1.1 431 Request Header Fields Too Large
Content-Type: text/html
<!doctype html>
<head>
 <title>Request Header Fields Too Large</title>
</head>
<body>
 <h1>Request Header Fields Too Large</h1>
 <p>「Cookie」標頭過大。</p>
</body>
</html>

規範

Specification
RFC 6585
# section-5

參見

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.

AltStyle によって変換されたページ (->オリジナル) /