410 Gone
Fault: Client
TL;DR
Resource permanently deleted with no forwarding address.
The resource is no longer available and will not be available again.
What This Error Means
The resource is no longer available and will not be available again.
Resource permanently deleted with no forwarding address.
Common Causes
- Resource intentionally removed
- Account deleted
- Content expired
How to Fix It (For Visitors)
- Resource no longer exists
- Look for alternatives
How to Fix It (For Developers/Admins)
- Use instead of 404 when resource is permanently gone
- Remove from search engine indexes
- Update internal links
Code Examples
Here's how to return a 410 status code in various programming languages:
Python (Flask)
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/endpoint')
def endpoint():
return jsonify({"message": "Gone"}), 410
Node.js (Express)
const express = require('express');
const app = express();
app.get('/endpoint', (req, res) => {
res.status(410).json({ message: 'Gone' });
});
PHP
<?php
http_response_code(410);
header('Content-Type: application/json');
echo json_encode(['message' => 'Gone']);
?>
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(410)
json.NewEncoder(w).Encode(map[string]string{
"message": "Gone",
})
}
Java (Spring Boot)
@GetMapping("/endpoint")
public ResponseEntity<Map<String, String>> endpoint() {
Map<String, String> response = new HashMap<>();
response.put("message", "Gone");
return ResponseEntity.status(410).body(response);
}
Ruby (Sinatra)
get '/endpoint' do
status 410
json message: 'Gone'
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.9.