HTTP 414 error: the web server says the URL is too long
414 Request-URI Too LargeShort answer
A 414 means the server refused the request because the URL is longer than it accepts. Most often a form or script sends large data in a GET query string. Send it in a POST body instead. If the URL grows on every request, you have a redirect loop. Raise server limits last.
Fix it fast
1Find out which cause you have
Measure the URL that fails. Copy it from the browser or the access log and count its characters.
printf '%s' 'PASTE-THE-FAILING-URL-HERE' | wc -c2Match what you see, then jump to its fix
- 1
The URL has a very long query string, for example a filter list, IDs, or form fields, and it is a GET request.Large data is sent in the query string of a GET requestFix - 2
The 414 appears after several redirects, and the address in the browser grows each time (a prefix or parameter is added on every hop).A redirect loop keeps making the URL longerFix - 3
The response comes from nginx and the URL is long but legitimate (for example a long signed link).nginx request line is larger than one header bufferFix - 4
The response comes from Apache and the request line is longer than 8190 bytes, or LimitRequestLine was lowered in your config.Apache LimitRequestLine is lower than the URL lengthFix
- 1
What does the error look like?
414 Request-URI Too Large
Cause 1 of 4
Large data is sent in the query string of a GET request
1Check
RFC 9110 names a POST improperly converted to a GET with long query information as a usual cause of 414. Check the form method or the HTTP call.
grep -rn "method=\"get\"\|method='get'" templates/ public/2Fix
Send the data in the request body with POST, and keep only short identifiers in the URL.
<form method="post" action="/search">
<input type="hidden" name="ids" value="1,2,3">
</form>3Verify
Submit the form and check for a 200 instead of 414.
curl -s -o /dev/null -w "%{http_code}\n" -X POST -d "ids=1,2,3" https://example.com/searchConfirmed by rfc-editor.org
Cause 2 of 4
A redirect loop keeps making the URL longer
1Check
RFC 9110 lists a client stuck in an infinite loop of redirection, where a redirected URI prefix points to a suffix of itself, as another cause. Follow the redirects and watch the Location header.
curl -sIL --max-redirs 10 https://example.com/start | grep -i "^location"2Fix
Fix the rewrite or redirect rule that appends to the URL instead of replacing it, so the same request ends after one redirect.
# nginx: a redirect that does not repeat itself
location = /old-page {
return 301 /new-page;
}3Verify
Run the redirect check again; it should show one hop.
curl -sIL --max-redirs 10 https://example.com/old-page | grep -i "^location"Confirmed by rfc-editor.org
Cause 3 of 4
nginx request line is larger than one header buffer
1Check
nginx returns 414 when the request line does not fit in one buffer set by large_client_header_buffers. The default is 4 buffers of 8k.
sudo nginx -T 2>/dev/null | grep -n "large_client_header_buffers"2Fix
Raise the buffer size in the http or server block. Keep it as small as you can, and prefer shortening the URL.
large_client_header_buffers 4 16k;3Verify
Test the config, reload nginx and repeat the request.
sudo nginx -t && sudo systemctl reload nginxConfirmed by nginx.org
Cause 4 of 4
Apache LimitRequestLine is lower than the URL length
1Check
LimitRequestLine sets the bytes allowed on the request line (method, URI and protocol), so it limits the URL including the query string. The default is 8190.
grep -rn "LimitRequestLine" /etc/apache2/ /etc/httpd/ 2>/dev/null2Fix
Raise the value in server config or the virtual host. The manual advises against changing it without need, so do this only for a URL you cannot shorten.
LimitRequestLine 163803Verify
Check the syntax, reload Apache and repeat the request.
curl -s -o /dev/null -w "%{http_code}\n" "https://example.com/path?long=query"Confirmed by httpd.apache.org
How do I stop it coming back?
- Use POST for searches and filters that carry lists of values.
- Log the longest request URLs once a month so growth is noticed early.
- Keep links you send in email short; avoid putting full state in the URL.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- stegnor.comMy company site: 804 pages from a Python and Jinja generator, with 15 free browser tools.
- Spotless LaundryAn on-demand laundry app: Flutter on a Laravel back end, with Firebase for live updates.
Related fixes
Servers
Docker php image has no php.ini and my edits do not stay
A setting changed in php.ini inside the container is gone after the container is recreated
The official php image ships php.ini-development and php.ini-production but no active php.ini.
2 causes, each with a fixServers
nginx gives up waiting for the app and returns 504
upstream timed out (110: Connection timed out) while reading response header from upstream
nginx returns 504 when the app behind it takes the request but sends nothing back within proxy_read_timeout (60 seconds by default), or when the connection cannot be opened in time.
5 causes, each with a fixServers
nginx and PHP-FPM show File not found or Primary script unknown
File not found.
PHP-FPM received a script path it could not turn into a file.
4 causes, each with a fixServers
nginx still returns 504 although the PHP script has a long time limit
upstream timed out (110: Connection timed out) while reading response header from upstream
set_time_limit() only controls PHP.
4 causes, each with a fixServers
nginx cannot open the PHP-FPM socket: Permission denied
502 Bad Gateway
nginx runs as one user and PHP-FPM creates its socket for another.
3 causes, each with a fixServers
Cookies from a PHP backend vanish behind an nginx proxy
Login works when you call the backend directly but fails through nginx
nginx forwards Set-Cookie headers from the backend unchanged, so lost cookies usually come from the cookie itself: a domain or path that does not match the public URL, or Secure and SameSite flags the browser rejects.
4 causes, each with a fix