414 URI Too Long
Fault: Client
TL;DR
URL is too long for the server to process.
The URI requested by the client is longer than the server is willing to interpret.
What This Error Means
The URI requested by the client is longer than the server is willing to interpret.
URL is too long for the server to process.
Common Causes
- Excessive query parameters
- Very long URL
- Too much data in GET request
How to Fix It (For Visitors)
- Use shorter URL
- Contact website support
How to Fix It (For Developers/Admins)
- Use POST instead of GET for large data
- Reduce query parameters
- Increase LimitRequestLine (Apache)
- Use request body for large payloads
Code Examples
Here's how to return a 414 status code in various programming languages:
Python (Flask)
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/endpoint')
def endpoint():
return jsonify({"message": "URI Too Long"}), 414
Node.js (Express)
const express = require('express');
const app = express();
app.get('/endpoint', (req, res) => {
res.status(414).json({ message: 'URI Too Long' });
});
PHP
<?php
http_response_code(414);
header('Content-Type: application/json');
echo json_encode(['message' => 'URI Too Long']);
?>
Go
package main
import (
"encoding/json"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(414)
json.NewEncoder(w).Encode(map[string]string{
"message": "URI Too Long",
})
}
Java (Spring Boot)
@GetMapping("/endpoint")
public ResponseEntity<Map<String, String>> endpoint() {
Map<String, String> response = new HashMap<>();
response.put("message", "URI Too Long");
return ResponseEntity.status(414).body(response);
}
Ruby (Sinatra)
get '/endpoint' do
status 414
json message: 'URI Too Long'
end
Browser Compatibility
| Browser | Support | Notes |
|---|---|---|
| Chrome | ✓ Full Support | All versions |
| Firefox | ✓ Full Support | All versions |
| Safari | ✓ Full Support | All versions |
| Edge | ✓ Full Support | All versions |
Official Specification
This status code is defined in RFC 7231 Section 6.5.12.