Nginx: 400 Bad Request — Request Header Or Cookie Too Large / client sent too long header line
The request line or headers (often cookies) exceed large_client_header_buffers.
400 Bad Request Request Header Or Cookie Too Large nginxclient sent too long header lineclient sent too long URI while reading client request line414 Request-URI Too Large nginxRequest Header Or Cookie Too Large Meaning
Raise large_client_header_buffers 4 16k; (and client_header_buffer_size 4k), and reduce cookie bloat: remove old cookies, shorten session data. Typical after apps set many/huge cookies (analytics, auth tokens). Also affects very long query strings (414).
Common causes
- Large or many cookies
- Very long URLs (414)
- Big JWTs in headers
- Default 8k header buffer
- Cookies accumulating on a shared parent domain
⚡ Quick fix
large_client_header_buffers 4 16k;inhttp/server- Clear/shrink cookies; store less in cookies
- Use POST for large payloads instead of query strings
Detailed fix by platform
Nginx
http { client_header_buffer_size 4k; large_client_header_buffers 4 16k; }
How to diagnose
- Header — Cookie size?
- URL — Too long?
- Buffers — Value?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Nginx / Apache
- nginx: [emerg] unknown directive Nginx: nginx: [emerg] unknown directive "x" in /etc/nginx/sites-enabled/x:12 — configuration file test failed
- upstream timed out Nginx: upstream timed out (110: Connection timed out) while reading response header from upstream
- AH00558 Apache: AH00558: apache2: Could not reliably determine the server's fully qualified domain name
Other ways to find it
Where this error sits
Origin: Edge & web server. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026