(轉)Request Header Or Cookie Too Large(Nginx config)

來源:互聯網
上載者:User

標籤:

看到huoding.com上有比較好的文章,於是理解並用自己的話來描述啦

加大client_header_buffer_size和large_client_header_buffers可以解決問題,但是為毛要兩個參數來控制呢?一個不久可以滿足要求了嗎?

client_header_buffer_size用來緩衝要求標頭,如果超過的話就會返回400錯誤了。但是如果絕大多數請求不會超過這個值的話,那麼更大的要求標頭可以受large_client_headers_buffers的影響。

還是貼nginx的原話吧

  • client_header_buffer_size: Sets buffer size for reading client request header. For most requests, a buffer of 1K bytes is enough. However, if a request includes long cookies, or comes from a WAP client, it may not fit into 1K. If a request line or a request header field does not fit into this buffer then larger buffers, configured by the large_client_header_buffers directive, are allocated.
  • large_client_header_buffers: Sets the maximum number and size of buffers used for reading large client request header. A request line cannot exceed the size of one buffer, or the 414 (Request-URI Too Large) error is returned to the client. A request header field cannot exceed the size of one buffer as well, or the 400 (Bad Request) error is returned to the client. Buffers are allocated only on demand. By default, the buffer size is equal to 8K bytes. If after the end of request processing a connection is transitioned into the keep-alive state, these buffers are released.

用兩個參數來控制緩衝大小的原因是為了平衡記憶體資源和處理速度的矛盾。

(轉)Request Header Or Cookie Too Large(Nginx config)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.