HTTPQUERY
中文

414 URI Too Long

Usage

When the 414 URI Too Long error message is received, the client understands the server expects a smaller HTTP path or address. While the specification does not stipulate any requirement for length, in practice, browsers limit the size to prevent certain types of attacks.

Servers, reverse proxies, and frameworks each impose their own URI length limits. Common defaults range from 4 KB to 8 KB, though no specification defines a maximum.

The 414 URI Too Long response is cacheable by default.

Example

The client requests a resource using a URI beyond what the server allows.

Request

GET /<...a_long_URI...> HTTP/1.1
Host: example.com

Response

HTTP/1.1 414 URI Too Long

How to fix

The most common cause is a GET request with too many query parameters or excessively long values encoded in the URL. A redirect loop or misconfigured rewrite rule appending parameters on each cycle also triggers this error.

Client-side fixes:

nginx: Increase large_client_header_buffers to allow longer request lines. The directive takes two values: buffer count and buffer size, e.g. large_client_header_buffers 4 32k. Restart nginx to apply.

Apache: Set LimitRequestLine in httpd.conf to a higher byte value. The default is 8190 bytes. Values up to 128000 are common for applications with long URLs. Restart Apache after the change.

IIS: Edit maxUrl and maxQueryString in the web.config file under system.webServer > security > requestFiltering > requestLimits. The defaults are 4096 bytes for URL length and 2048 bytes for query strings. Keep these values as low as practical. Large URL limits increase exposure to injection attacks.

When the error appears in a browser rather than an API, clearing the browser cache and Cookies sometimes resolves the issue, especially when stale cookies inflate the request header size beyond server limits.

Code references

.NET

HttpStatusCode.RequestUriTooLong

Rust

http::StatusCode::URI_TOO_LONG

Rails

:uri_too_long
:request_uri_too_long

Go

http.StatusRequestURITooLong

Symfony

Response::HTTP_REQUEST_URI_TOO_LONG

Python3.5+

http.HTTPStatus.REQUEST_URI_TOO_LONG

Java

java.net.HttpURLConnection.HTTP_REQ_TOO_LONG

Apache HttpComponents Core

org.apache.hc.core5.http.HttpStatus.SC_REQUEST_URI_TOO_LONG

Angular

@angular/common/http/HttpStatusCode.UriTooLong