414 URI Too Long
Description
The 414 URI Too Long
status code indicates that the server is refusing to service the request because the request URI (typically the URL) is longer than the server is willing to interpret. This status code is used when the URI exceeds the server's configured limits, which could be due to security concerns or technical limitations.
This status code is commonly used when: - A client includes excessive query parameters in a GET request - A client attempts to pass too much data via the URL instead of the request body - A client generates URLs with deeply nested paths - A server needs to protect against certain attacks that use extremely long URLs
The 414 URI Too Long
status helps servers maintain security and performance by rejecting requests with excessively long URIs that might cause processing issues or represent potential attack vectors.
Syntax
The server responds with a 414 URI Too Long
status:
HTTP/1.1 414 URI Too Long
Content-Type: application/json
Content-Length: [length in bytes]
{
"error": "URI Too Long",
"message": "The requested URI exceeds the maximum length the server can process"
}
Examples
Excessive Query Parameters Example
A client sends a request with too many query parameters:
Client Request:
GET /search?q=example&filter1=value1&filter2=value2&filter3=value3&filter4=value4&filter5=value5&filter6=value6&filter7=value7&filter8=value8&filter9=value9&filter10=value10&filter11=value11&filter12=value12&filter13=value13&filter14=value14&filter15=value15&[...hundreds more parameters...] HTTP/1.1
Host: search.example.com
Server Response:
HTTP/1.1 414 URI Too Long
Content-Type: application/json
Content-Length: 187
{
"error": "URI Too Long",
"message": "The request URL exceeds the maximum length of 2048 characters",
"max_length": 2048,
"your_length": 3500,
"suggestion": "Use POST with a request body instead of GET for complex queries"
}
Deep Path Nesting Example
A client sends a request with an excessively nested path:
Client Request:
GET /category/subcategory/sub-subcategory/sub-sub-subcategory/sub-sub-sub-subcategory/sub-sub-sub-sub-subcategory/sub-sub-sub-sub-sub-subcategory/sub-sub-sub-sub-sub-sub-subcategory/product/variant/detail/specifications/technical/advanced/complete HTTP/1.1
Host: shop.example.com
Server Response:
HTTP/1.1 414 URI Too Long
Content-Type: text/html
Content-Length: 312
<!DOCTYPE html>
<html>
<head>
<title>URI Too Long</title>
</head>
<body>
<h1>414 URI Too Long</h1>
<p>The requested URL exceeds our path depth limit.</p>
<p>Please use a shorter path or our site search functionality to find the product you're looking for.</p>
<p><a href="/search">Go to search</a></p>
</body>
</html>
Data in URL Example
A client attempts to pass too much data in the URL instead of using a request body:
Client Request:
GET /process?data=eyJmaWVsZDEiOiJ2YWx1ZTEiLCJmaWVsZDIiOiJ2YWx1ZTIiLCJmaWVsZDMiOiJ2YWx1ZTMiLCJmaWVsZDQiOiJ2YWx1ZTQiLCJmaWVsZDUiOiJ2YWx1ZTUiLCJmaWVsZDYiOiJ2YWx1ZTYiLCJmaWVsZDciOiJ2YWx1ZTciLCJmaWVsZDgiOiJ2YWx1ZTgiLCJmaWVsZDkiOiJ2YWx1ZTkiLCJmaWVsZDEwIjoidmFsdWUxMCIsImZpZWxkMTEiOiJ2YWx1ZTExIiwiZmllbGQxMiI6InZhbHVlMTIiLCJmaWVsZDEzIjoidmFsdWUxMyIsImZpZWxkMTQiOiJ2YWx1ZTE0IiwiZmllbGQxNSI6InZhbHVlMTUiLCJmaWVsZDE2IjoidmFsdWUxNiIsImZpZWxkMTciOiJ2YWx1ZTE3IiwiZmllbGQxOCI6InZhbHVlMTgiLCJmaWVsZDE5IjoidmFsdWUxOSIsImZpZWxkMjAiOiJ2YWx1ZTIwIiwiZmllbGQyMSI6InZhbHVlMjEiLCJmaWVsZDIyIjoidmFsdWUyMiIsImZpZWxkMjMiOiJ2YWx1ZTIzIiwiZmllbGQyNCI6InZhbHVlMjQiLCJmaWVsZDI1IjoidmFsdWUyNSIsImZpZWxkMjYiOiJ2YWx1ZTI2IiwiZmllbGQyNyI6InZhbHVlMjciLCJmaWVsZDI4IjoidmFsdWUyOCIsImZpZWxkMjkiOiJ2YWx1ZTI5IiwiZmllbGQzMCI6InZhbHVlMzAiLCJmaWVsZDMxIjoidmFsdWUzMSIsImZpZWxkMzIiOiJ2YWx1ZTMyIiwiZmllbGQzMyI6InZhbHVlMzMiLCJmaWVsZDM0IjoidmFsdWUzNCIsImZpZWxkMzUiOiJ2YWx1ZTM1IiwiZmllbGQzNiI6InZhbHVlMzYiLCJmaWVsZDM3IjoidmFsdWUzNyIsImZpZWxkMzgiOiJ2YWx1ZTM4IiwiZmllbGQzOSI6InZhbHVlMzkiLCJmaWVsZDQwIjoidmFsdWU0MCIsImZpZWxkNDEiOiJ2YWx1ZTQxIiwiZmllbGQ0MiI6InZhbHVlNDIiLCJmaWVsZDQzIjoidmFsdWU0MyIsImZpZWxkNDQiOiJ2YWx1ZTQ0IiwiZmllbGQ0NSI6InZhbHVlNDUiLCJmaWVsZDQ2IjoidmFsdWU0NiIsImZpZWxkNDciOiJ2YWx1ZTQ3IiwiZmllbGQ0OCI6InZhbHVlNDgiLCJmaWVsZDQ5IjoidmFsdWU0OSIsImZpZWxkNTAiOiJ2YWx1ZTUwIn0= HTTP/1.1
Host: api.example.com
Server Response:
HTTP/1.1 414 URI Too Long
Content-Type: application/json
Content-Length: 243
{
"error": "URI Too Long",
"message": "The request URL exceeds the maximum allowed length",
"suggestion": "Use a POST request with the data in the request body instead of encoding it in the URL",
"example_endpoint": "POST /process"
}
Summary
The 414 URI Too Long
status code is an important mechanism for servers to protect themselves from requests with excessively long URIs that might cause processing issues or represent security risks. It helps guide clients toward more appropriate request patterns, such as using POST requests with request bodies for complex data instead of encoding everything in the URL. This status code is particularly relevant for search functionality, filtering systems, and APIs where clients might attempt to include large amounts of data in query parameters.