400 Bad Request – request header or cookie too large

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.

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;
    # ...
}

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.

Leave a Comment