Troubleshooting guide
414 URI Too Long: causes and how to fix it
A 414 means the URL itself was longer than the server will read. The URL has usually grown by accident, and the bug that grew it is what needs fixing.
3 min read10 sectionsUpdated
On this page
Common causes
- A redirect that re-appends its own parameters, such as a login page adding
?next=on each hop until the URL explodes. - Filters in a GET request, like hundreds of IDs in a query string.
- State encoded in the URL by a front-end app.
- Tracking parameters stacked by chained marketing redirects.
Diagnose it
Follow the redirects and watch whether the URL gets longer on each hop. That immediately tells you if it is a loop.
# Watch each hop and its length
curl -sIL --max-redirs 8 https://example.com/account | grep -i '^location' | awk '{print length($0), $0}' | cut -c1-140
# Check the limit Nginx is really using
sudo nginx -T 2>/dev/null | grep large_client_header_buffers
# Find the longest URLs that reach the server
awk '{print length($7), $7}' /var/log/nginx/access.log | sort -rn | head -5 | cut -c1-200Fixes
Fix growth at the source: a next parameter must be set once and never wrap itself. Move large filters into a POST body, or store the filter on the server and pass a short ID. If a legitimate URL truly is long and cannot change, raise the buffer modestly, such as large_client_header_buffers 4 16k;, and check that the CDN and every proxy accept the same length. Keep URLs under about 2,000 characters if they must work everywhere.
Catch it automatically
Alert on any 414 at all: unlike most 4xx codes, it rarely occurs in normal traffic and usually points to a real bug. The redirect guide explains how to keep chains short, and log management can chart URL length when you index it as a field.
What is the maximum URL length?
HTTP sets no limit, but real software does. Staying below about 2,000 characters works across browsers, servers and CDNs.
Should I increase large_client_header_buffers?
Only for a real long URL that cannot be redesigned. If a redirect loop is growing the URL, a bigger buffer only delays the failure.
Does this also happen with Cloudflare?
Yes, Cloudflare enforces its own URL length limit, so check it as well as the origin.
Check it now, free
- Website down checker: Is it down for everyone or just me? Check any site now.
Related reading
- 408 Request Timeout: causes and how to fix it: Understand 408 Request Timeout: slow client uploads, idle keep-alive connections and proxy settings, and how it differs from a 504 Gateway Timeout.
- 400 Bad Request: what it means and how to fix it: Fix a 400 Bad Request error: oversized cookies, malformed URLs, invalid JSON bodies and proxy rules, with commands to find which layer rejected it.
- 413 Request Entity Too Large: how to raise the limit safely: Fix 413 Request Entity Too Large in Nginx, Apache, Node.js, PHP and Kubernetes ingress: find which layer sets the limit and raise it safely for uploads.
- Elasticsearch CircuitBreakingException: how to fix it: Fix Elasticsearch CircuitBreakingException Data too large: reduce fielddata and huge aggregations, size JVM heap correctly and check shard counts per node.
- 503 Service Unavailable: causes and fixes: Why servers return 503 Service Unavailable, from overload and maintenance to no healthy backends, how to diagnose each cause and how to recover and prevent it.
- .NET OutOfMemoryException: causes and how to fix it: Fix .NET System.OutOfMemoryException: use dotnet-counters and dotnet-gcdump, spot Large Object Heap fragmentation and set the right GC limits in containers.
Watch your own site and services with VitalRix
Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.