< HTTP/1.1 414 URI Too Long414 URI Too Long
The requested URI exceeds the server's maximum length limit. Learn about URI length limits and how to handle oversized requests.
- Cacheable
- Yes, by default
- Retry?
- No: shorten the URI
- Usually sent by
- Reverse proxy or web server
- Often confused with
- 413
On this page
TL;DR: Your URL exceeds the server’s length limit (usually from too many query parameters). Use POST method for large data instead.
What is 414 URI Too Long?
A 414 URI Too Long status code means the URI (URL) requested by the client is longer than the server is willing to process. Think of it like trying to write an address on an envelope that’s too long to fit—the postal service can’t process it because it exceeds their format limits.
This commonly happens when too much data is passed in query parameters, especially when GET requests are used inappropriately for large data submissions.
When Does This Happen?
You’ll see a 414 URI Too Long response in these common situations:
1. Excessive Query Parameters
Too many filters or search parameters in URL
/search?param1=value1¶m2=value2&... [5000+ characters] → 414
2. Large Data in GET Request
Attempting to send large data via GET instead of POST
/api/submit?data=[huge-json-encoded-string] → 414
3. Redirect Loop Accumulation
Redirect chain appending parameters each time
/page?a=1 → /page?a=1&b=2 → /page?a=1&b=2&c=3 → ... → 414
4. Array/List in Query String
Passing large arrays via URL
/filter?ids[]=1&ids[]=2&ids[]=3... [1000 IDs] → 414
5. Base64-Encoded Data in URL
Embedding large files in query parameters
/preview?image=data:image/png;base64,[100KB of data] → 414
Example Responses
Basic URI Too Long:
HTTP/1.1 414 URI Too Long
Content-Type: application/json
Content-Length: 245
{
"error": "URI Too Long",
"message": "The requested URI exceeds the maximum allowed length",
"uri_length": 10240,
"max_allowed_length": 8192,
"suggestion": "Use POST method to send large amounts of data"
}
With Alternative Endpoint:
HTTP/1.1 414 URI Too Long
Content-Type: application/json
Link: <https://api.example.com/search>; rel="alternate"; method="POST"
{
"error": "URI Too Long",
"message": "Query string exceeds maximum length of 4096 characters",
"uri_length": 5823,
"max_length": 4096,
"alternatives": {
"post_endpoint": {
"url": "/api/search",
"method": "POST",
"description": "Send search parameters in request body"
}
},
"documentation": "https://docs.example.com/api/search-limits"
}
Server-Specific Limits:
HTTP/1.1 414 URI Too Long
Content-Type: text/html
Server: nginx/1.24.0
<!DOCTYPE html>
<html>
<head><title>414 URI Too Long</title></head>
<body>
<h1>Request URI Too Long</h1>
<p>The requested URL's length exceeds the capacity limit for this server.</p>
<p>Maximum allowed URI length: 8192 characters</p>
<p>Your request length: 12456 characters</p>
<p>Please reduce the URL length or use POST method instead.</p>
</body>
</html>
Real-World Example
Imagine you’re building a report filtering system with too many parameters:
Client Request with Excessive Parameters:
GET /api/reports?year=2026&month=1&month=2&month=3&month=4&month=5&month=6&month=7&month=8&month=9&month=10&month=11&month=12&category=sales&category=marketing&category=operations&category=hr&category=finance&category=it®ion=north®ion=south®ion=east®ion=west&product_id=1&product_id=2&product_id=3...[continues for 500 products]...&format=pdf&include_charts=true&include_tables=true&include_summary=true&timezone=America/New_York HTTP/1.1
Host: api.example.com
Accept: application/json
Server Response:
HTTP/1.1 414 URI Too Long
Content-Type: application/json
Link: <https://api.example.com/reports/query>; rel="alternate"; method="POST"
X-Max-URI-Length: 8192
X-Actual-URI-Length: 15234
{
"status": 414,
"error": "URI Too Long",
"message": "Request URI exceeds server maximum length",
"details": {
"max_uri_length": 8192,
"actual_uri_length": 15234,
"excess_length": 7042,
"query_param_count": 523
},
"solution": {
"description": "Use POST method for complex queries",
"endpoint": "/api/reports/query",
"method": "POST",
"example": {
"url": "https://api.example.com/api/reports/query",
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"body": {
"year": 2026,
"months": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
"categories": ["sales", "marketing", "operations"],
"product_ids": [1, 2, 3, "..."]
}
}
},
"documentation": "https://docs.example.com/api/query-limits"
}
414 vs Other Request Error Codes
| Code | Meaning | Issue | Solution |
|---|---|---|---|
| 414 | URI too long | URL exceeds length limit | Use POST or shorten URL |
| 413 | Payload too large | Request body too big | Reduce body size or chunk |
| 400 | Bad request | Malformed request | Fix request syntax |
| 431 | Headers too large | Request headers too big | Reduce header size |
Important Characteristics
Common URI Length Limits:
Browser limits:
- Chrome: ~2MB (practical limit ~32KB)
- Firefox: ~65,536 characters
- Safari: ~80,000 characters
- IE/Edge: 2,083 characters (legacy)
Server limits:
- Apache: 8,190 bytes (default)
- Nginx: 4K-8K bytes (configurable)
- IIS: 16,384 characters (configurable)
- Node.js: 80KB (http-parser default)
Query String vs Request Body:
GET with long query string:
/api/search?q=long&filters=[huge array] → Risk of 414
POST with request body:
POST /api/search
Body: {"q": "long", "filters": [...]} → Better approach
URL Encoding Overhead:
Original: "hello world"
Encoded: "hello%20world" ← 20% increase in length
Common Mistakes
❌ Using GET for large data submissions
GET /api/submit?data=[10KB of base64 encoded data] → 414
❌ Putting arrays in query string
GET /filter?ids=1,2,3,4,5,6,7,8...[500 IDs] → 414
❌ Encoding entire objects in URL
GET /preview?config={"theme":"dark","options":[...]...} → 414
✅ Use POST for large data
POST /api/submit
Content-Type: application/json
{
"data": "[large payload]",
"ids": [1, 2, 3, 4, 5, ...]
}
Getting 414 URI Too Long right
Use POST for Large Data:
// Bad: GET with huge query string
fetch('/api/search?filters=' + encodeURIComponent(JSON.stringify(largeFilters)))
// Good: POST with body
fetch('/api/search', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ filters: largeFilters })
})
Implement Pagination and Filtering:
// Bad: Request all IDs at once
/api/records?ids=1,2,3,4,5...[1000 IDs]
// Good: Use pagination or POST
POST /api/records/batch
{"ids": [1, 2, 3, ...], "page": 1, "limit": 100}
Provide Clear Error Messages:
HTTP/1.1 414 URI Too Long
Content-Type: application/json
{
"error": "URI Too Long",
"message": "URL exceeds 8192 character limit",
"current_length": 12456,
"max_length": 8192,
"recommendations": [
"Use POST method instead of GET",
"Reduce number of query parameters",
"Use request body for large data",
"Implement pagination for large result sets"
],
"alternative_endpoints": [
{
"method": "POST",
"url": "/api/search",
"description": "Submit search parameters in request body"
}
]
}
Configure Server Limits Appropriately:
# Nginx configuration
large_client_header_buffers 4 16k;
http {
# Increase URI size limit
client_header_buffer_size 16k;
}
# Apache configuration
LimitRequestLine 16384
Implementation Examples
Express.js Error Handling:
const express = require('express')
const app = express()
// Set maximum URL length
app.use((req, res, next) => {
const MAX_URL_LENGTH = 8192
const fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl
if (fullUrl.length > MAX_URL_LENGTH) {
return res.status(414).json({
error: 'URI Too Long',
message: 'Request URL exceeds maximum allowed length',
current_length: fullUrl.length,
max_length: MAX_URL_LENGTH,
suggestion: 'Use POST method for large data submissions'
})
}
next()
})
// Alternative POST endpoint for long queries
app.post('/api/search', (req, res) => {
const { filters, sort, pagination } = req.body
// Handle search with body parameters
res.json({ results: performSearch(req.body) })
})
Django:
from django.http import JsonResponse
from django.conf import settings
class URILengthMiddleware:
def __init__(self, get_response):
self.get_response = get_response
self.max_uri_length = getattr(settings, 'MAX_URI_LENGTH', 8192)
def __call__(self, request):
full_path = request.build_absolute_uri()
if len(full_path) > self.max_uri_length:
return JsonResponse({
'error': 'URI Too Long',
'message': f'URI length {len(full_path)} exceeds maximum {self.max_uri_length}',
'max_length': self.max_uri_length,
'current_length': len(full_path),
'alternative': {
'method': 'POST',
'endpoint': request.path
}
}, status=414)
return self.get_response(request)
ASP.NET Core:
public class URILengthMiddleware
{
private readonly RequestDelegate _next;
private const int MaxUriLength = 8192;
public URILengthMiddleware(RequestDelegate next)
{
_next = next;
}
public async Task InvokeAsync(HttpContext context)
{
var uri = $"{context.Request.Scheme}://{context.Request.Host}{context.Request.Path}{context.Request.QueryString}";
if (uri.Length > MaxUriLength)
{
context.Response.StatusCode = 414;
context.Response.ContentType = "application/json";
await context.Response.WriteAsJsonAsync(new
{
error = "URI Too Long",
message = "Request URI exceeds maximum allowed length",
current_length = uri.Length,
max_length = MaxUriLength,
suggestion = "Use POST method for large data"
});
return;
}
await _next(context);
}
}
Client-Side Prevention
Check URL Length Before Sending:
function makeAPIRequest(endpoint, params) {
const queryString = new URLSearchParams(params).toString()
const fullUrl = `${endpoint}?${queryString}`
const MAX_URL_LENGTH = 8000 // Conservative limit
if (fullUrl.length > MAX_URL_LENGTH) {
// Switch to POST automatically
return fetch(endpoint, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(params)
})
}
// Safe to use GET
return fetch(fullUrl)
}
Paginate Large Requests:
// Bad: All IDs at once
const ids = Array.from({ length: 1000 }, (_, i) => i + 1)
fetch(`/api/items?ids=${ids.join(',')}`) // URI too long!
// Good: Batch requests
async function fetchItemsInBatches(ids, batchSize = 100) {
const results = []
for (let i = 0; i < ids.length; i += batchSize) {
const batch = ids.slice(i, i + batchSize)
const response = await fetch('/api/items', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ ids: batch })
})
results.push(...(await response.json()))
}
return results
}
Try It Yourself
Visit our request builder and trigger a 414 response:
- Set method to GET
- Set path to /api/search
- Add query with 1000+ parameters
- Click Send request
- See 414 with suggested POST alternative
Try it with curl
Build a URL longer than the server’s request-line limit. nginx’s default is 8 KB per header buffer (large_client_header_buffers 4 8k), so 10,000 characters is enough there.
curl -i "https://api.example.com/search?q=$(head -c 10000 /dev/zero | tr '\0' 'a')"
Example output (illustrative, not captured from a real server):
HTTP/1.1 414 Request-URI Too Large
Server: nginx
The reason phrase differs by server (RFC 9110 calls the status URI Too Long). Limits vary, so change the head -c count to find a given server’s threshold.
Related Status Codes
- 413 Payload Too Large - Request body exceeds size limit
- 431 Request Header Fields Too Large - Request headers too large
- 400 Bad Request - Malformed request
- 200 OK - Successful request with appropriate size
Frequently asked questions
What does 414 URI Too Long mean?
A 414 error means the URL you requested exceeds the server maximum length. This usually happens with very long query strings or when data is incorrectly placed in the URL instead of the request body.
What is the maximum URL length?
There is no official limit, but browsers cap around 2000-8000 characters. Servers vary: Apache defaults to 8190 bytes, Nginx to 8KB, IIS to 16KB. Keep URLs under 2000 characters for compatibility.
How do I fix a 414 error?
Use POST instead of GET for large data, move query parameters to the request body, shorten parameter names, or paginate results to reduce URL length.
Why does my search URL cause 414?
Complex search filters with many parameters can exceed URL limits. Use POST for search requests with many filters, or store filter state server-side and reference it with a short ID.
Sources
Related
400 Bad Request
400 Bad Request means the server could not parse your request. Find which layer sent it, fix bad JSON and oversized cookies or headers, and reproduce with curl.
405 Method Not Allowed
405 Method Not Allowed means the URL exists but not for that method. Read the Allow header, then fix redirects turning POST into GET, static hosting and WAFs.
406 Not Acceptable
The server cannot produce a response matching the client's Accept headers. Learn about content negotiation and how to handle format mismatches.
408 Request Timeout
408 Request Timeout means the server gave up waiting for the client to finish sending. Tune nginx, Apache, Node and ALB timeouts and tell it apart from 504.