See huoding.com on the better posts, so understand and use their own words to describe
Increase client_header_buffer_size and large_client_header_buffers can solve the problem, but for Mao to two parameters to control it? Can one meet the requirements soon?
The client_header_buffer_size is used to cache the request header and returns a 400 error if it is exceeded. However, if the majority of requests do not exceed this value, then the larger request header can be affected by large_client_headers_buffers.
or the exact words of the 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_CLI Ent_header_buffers directive, is allocated.
- large_client_header_buffers: Sets the maximum number and size of buffers used for reading large client request he Ader. 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 the "Bad Request" error is returned to the CLI Ent. Buffers is allocated only on demand. By default, the buffer size is equal to 8K bytes. If after the end of request processing a connection was transitioned into the keep-alive state, these buffers is released.
The reason to control the cache size with two parameters is to balance the contradiction between memory resources and processing speed.
Go Request Header Or Cookie Too Large (Nginx config)