505 HTTP Version Not Supported
Fault: Server
TL;DR
Server doesn't support the HTTP version in the request.
The server does not support the HTTP protocol version used in the request.
What This Error Means
The server does not support the HTTP protocol version used in the request.
Server doesn't support the HTTP version in the request.
Common Causes
- Client using HTTP/2 with HTTP/1.1-only server
- Outdated server software
- HTTP version mismatch
How to Fix It (For Visitors)
- Update your browser
- Contact website administrator
How to Fix It (For Developers/Admins)
- Update server software
- Enable HTTP/2 support
- Configure protocol versions
- Update Nginx/Apache
Code Examples
Here's how to return a 505 status code in various programming languages:
Python (Flask)
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/endpoint')
def endpoint():
return jsonify({"message": "HTTP Version Not Supported"}), 505
Node.js (Express)
const express = require('express');
const app = express();
app.get('/endpoint', (req, res) => {
res.status(505).json({ message: 'HTTP Version Not Supported' });
});
PHP
<?php
http_response_code(505);
header('Content-Type: application/json');
echo json_encode(['message' => 'HTTP Version Not Supported']);
?>
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(505)
json.NewEncoder(w).Encode(map[string]string{
"message": "HTTP Version Not Supported",
})
}
Java (Spring Boot)
@GetMapping("/endpoint")
public ResponseEntity<Map<String, String>> endpoint() {
Map<String, String> response = new HashMap<>();
response.put("message", "HTTP Version Not Supported");
return ResponseEntity.status(505).body(response);
}
Ruby (Sinatra)
get '/endpoint' do
status 505
json message: 'HTTP Version Not Supported'
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.6.6.