405 Method Not Allowed: what it means and what to do
A 405 means the address exists, but the way the request asked is not permitted there. The official definition in RFC 9110 is that the server knows the request method, such as GET, POST, PUT, or DELETE, but the target resource does not support it. The server is required to send an Allow header listing the methods that resource does accept, which makes 405 one of the most informative error codes when it is implemented properly.
If you are just visiting a site
- Refresh and retry the action once. Most 405s seen by visitors come from a form or button sending a request the page was not built to receive, often after a site update.
- Go back and navigate from the homepage. A bookmarked link into the middle of a checkout, upload, or account flow can replay a request type the current page no longer accepts.
- Try the site's app or a different browser if the action matters. If it works elsewhere, the page you were on is stale.
- Otherwise, it is the site's bug, not yours. There is no visitor-side setting that changes which methods a resource allows. Report it with the page address and what you clicked.
If it is your site or your API
- Read your own Allow header. It tells you exactly which methods the route is registered for. The mismatch between that list and what the client sent is the whole bug.
- Check the route definition. The usual cause is a route registered for GET that receives a POST form submission, or a framework resource that only implements some verbs.
- Check static hosting and CDN rules. Static hosts commonly reject POST, PUT, and DELETE with a 405. A contact form posting to a static host will hit this every time.
- Mind the trailing slash. Some frameworks treat /items and /items/ as different routes with different method tables.
Visitors: you cannot fix a 405 from your side. Owners: the Allow header you are already required to send is the first debugging tool, compare it with the request in your access log.
Common questions
What is the difference between 405 and 404? A 404 says the resource does not exist at that address. A 405 says the resource exists but does not accept the HTTP method used. The address is right, the verb is wrong.
Why does a form submission cause a 405? Forms submit with GET or POST. If the page the form points at is served as a static file or a route that only accepts GET, the POST has nowhere to go and the server answers 405.
Related errors