- Home
- HTTP Status Codes
- 414 URI Too Long
Status Code
414 URI Too Long
The requested URI exceeds the server's maximum length limit. Learn about URI length limits and how to handle oversized requests.
What is 414 URI Too Long?
TL;DR: Your URL exceeds the server’s length limit (usually from too many query parameters). Use POST method for large data instead.
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"
}
```text
**With Alternative Endpoint:**
```http
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>
```text
## Real-World Example
Imagine you're building a report filtering system with too many parameters:
**Client Request with Excessive Parameters:**
```http
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"
}
```text
## 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:**
```text
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)
```text
**Query String vs Request Body:**
```http
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
```text
**URL Encoding Overhead:**
```http
Original: "hello world"
Encoded: "hello%20world" ← 20% increase in length
```text
## Common Mistakes
**❌ Using GET for large data submissions**
```http
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
```text
**❌ Encoding entire objects in URL**
```http
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, ...]
}
```text
## Best Practices
**Use POST for Large Data:**
```javascript
// 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}
```text
**Provide Clear Error Messages:**
```http
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;
}
```text
```apache
# 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) })
})
```javascript
**Django:**
```python
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);
}
}
```javascript
## Client-Side Prevention
**Check URL Length Before Sending:**
```javascript
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
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.