501 Not Implemented
Fault: Server
TL;DR
Server doesn't recognize the request method or can't fulfill it.
The server does not support the functionality required to fulfill the request.
What This Error Means
The server does not support the functionality required to fulfill the request.
Server doesn't recognize the request method or can't fulfill it.
Common Causes
- HTTP method not implemented
- Feature not supported
- Unrecognized request method
How to Fix It (For Visitors)
- Contact website administrator
- Use different client/browser
How to Fix It (For Developers/Admins)
- Implement the requested method
- Return 405 if method not allowed
- Update server software
- Enable required modules
Code Examples
Here's how to return a 501 status code in various programming languages:
Python (Flask)
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/endpoint')
def endpoint():
return jsonify({"message": "Not Implemented"}), 501
Node.js (Express)
const express = require('express');
const app = express();
app.get('/endpoint', (req, res) => {
res.status(501).json({ message: 'Not Implemented' });
});
PHP
<?php
http_response_code(501);
header('Content-Type: application/json');
echo json_encode(['message' => 'Not Implemented']);
?>
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(501)
json.NewEncoder(w).Encode(map[string]string{
"message": "Not Implemented",
})
}
Java (Spring Boot)
@GetMapping("/endpoint")
public ResponseEntity<Map<String, String>> endpoint() {
Map<String, String> response = new HashMap<>();
response.put("message", "Not Implemented");
return ResponseEntity.status(501).body(response);
}
Ruby (Sinatra)
get '/endpoint' do
status 501
json message: 'Not Implemented'
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.2.