HTTP 405 — Method Not Allowed
4xx Client Error
What it means
The URL exists but does not accept this HTTP method — a POST to a GET-only endpoint, for example.
What to do about it
Check the method. The response must include an Allow header listing what is accepted.
Where it sits
405 belongs to the 4xx family: The request contains something the server will not or cannot process. The fix is normally on the client side.
HTTP/1.1 405 Method Not Allowed
Checking it yourself
# see the status code and headers only
curl -sI https://example.com/path
# follow redirects and print each hop
curl -sIL -o /dev/null -w "%{http_code} %{url_effective}\n" https://example.com/path
# JavaScript
const r = await fetch(url);
console.log(r.status, r.statusText);
How this code behaves
| Cacheable by default | Yes — per RFC 9110, this status is cacheable unless headers say otherwise. |
| Safe to retry | No. Retrying an identical request will produce the same result — the request itself must change. |
| Effect on search indexing | No direct effect. |
Returning 405 correctly
# nginx
return 405;
# Express
res.status(405).json({ error: 'Method Not Allowed' });
# Go
w.WriteHeader(405)
# Python (Flask)
return jsonify(error='Method Not Allowed'), 405;
Frequently asked questions
What does HTTP 405 mean?
The URL exists but does not accept this HTTP method — a POST to a GET-only endpoint, for example.
How do I fix a 405 error?
Check the method. The response must include an Allow header listing what is accepted.
Is 405 a client or server problem?
A client problem by definition — the request needs to change. That said, a 4xx can still be the server’s fault if it is misconfigured and rejecting valid requests.