且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

400错误的请求-请求标头或cookie太大

更新时间:2021-08-06 00:10:58

这就是错误的意思-Request Header Or Cookie Too Large.您的标头之一确实很大,nginx拒绝了它.

It's just what the error says - Request Header Or Cookie Too Large. One of your headers is really big, and nginx is rejecting it.

您在使用large_client_header_buffers的正确轨道上.如果您检查文档,您会发现它仅在httpserver中有效上下文.将其撞到服务器块上,它将起作用.

You're on the right track with large_client_header_buffers. If you check the docs, you'll find it's only valid in http or server contexts. Bump it up to a server block and it will work.

server {
    # ...
    large_client_header_buffers 4 32k;
    # ...
}

顺便说一句,默认的缓冲区号和大小是48k,因此,错误的标头必须是超过8192字节的标头.在您的情况下,所有这些Cookie(合并到一个标头)都超出了限制.特别是那些混合面板cookie会变得很大.

By the way, the default buffer number and size is 4 and 8k, so your bad header must be the one that's over 8192 bytes. In your case, all those cookies (which combine to one header) are well over the limit. Those mixpanel cookies in particular get quite large.