A 405 Method Not Allowed is the server telling you that the address was right and the verb was wrong. Something is there, the server knows exactly what it is, and it does not accept the kind of request you sent to it.

The standard puts it precisely. RFC 9110 defines 405 as meaning “that the method received in the request-line is known by the origin server but not supported by the target resource”. The method is the verb at the front of every request: GET to read, POST to submit, PUT, PATCH and DELETE to change things. A 405 says the server recognises the verb, recognises the address, and does not allow that pairing.

What it means, in plain words

If you saw this on a website rather than in your own code: you did nothing wrong, and there is nothing in your browser to fix. The page asked the server to do something in a way that address does not accept, most often submitting a form to a place that only serves pages. That decision was made by whoever built the site, and it is theirs to correct.

Reloading will usually show the same error, because the request is wrong in the same way each time. If it happened after you pressed a button such as “Send” or “Save”, check whether what you submitted actually arrived before trying again, and tell the site what you clicked and when.

The detail most guides skip: the server has to tell you what it does accept

The same sentence in the RFC continues: “The origin server MUST generate an Allow header field in a 405 response containing a list of the target resource’s currently supported methods.”

So a correct 405 carries its own answer. Open the network panel, click the failed request, and look at the response headers for Allow:

HTTP/1.1 405 Method Not Allowed
Allow: GET, HEAD

That one line says the address exists and will answer a GET, and that your POST was the problem. Not every server bothers to send it, despite the “MUST”, but when it is there it ends the investigation.

405 against its neighbours

The 4xx codes are easy to confuse, and these are the ones a 405 gets mistaken for.

405 Method Not Allowed
The address exists and the server knows the method, but this address does not accept it. Check the verb
404 Not Found
There is nothing at the address at all, whatever the method
400 Bad Request
The request itself was malformed, so the server never got as far as the method and the address
501 Not Implemented
A 5xx, not a 4xx: the server does not recognise the method for any address. RFC 9110 calls it the right answer "when the server does not recognize the request method"

The practical difference with a 404 is the useful one: a 405 tells you that you found the right place. Unlike a 400, the shape of the request was fine. Only the verb needs changing.

Where a 405 actually comes from

Four causes account for most of them, and only the first is the obvious one.

The code sends the wrong method. The front end does a PUT where the API expects a PATCH, or a POST to an endpoint that only reads. A route was renamed or narrowed on the server and one caller was missed. This is the case the Allow header settles in seconds.

A form posts to a static page. A contact form submits with POST to an address that the web server answers by serving a file. nginx is explicit about this in its static file handler: a request with method POST returns NGX_HTTP_NOT_ALLOWED, which is the 405, and nginx’s default error page for it is titled simply “405 Not Allowed”. The same happens on hosts that only serve files, and it is why a form that worked against a development server fails the day the site goes onto static hosting.

A redirect quietly turned the POST into a GET. This is the one that wastes an afternoon. The form posts to /subscribe, the server redirects it to /subscribe/ with a 301 or 302, and the browser follows the redirect with a GET. The Fetch standard, which browsers implement, says it in as many words: when the status is 301 or 302 and the method is POST, set the request’s method to GET and its body to null. RFC 9110 calls this a historical behaviour and points to 307 and 308 for anyone who does not want it. So the endpoint that accepts POST receives a GET, answers 405, and the network panel shows a 405 on a request the code never made. The two requests sit next to each other in the log: the 301, then the 405.

The browser’s preflight was the request that failed. Before a cross-origin PUT, DELETE, or a POST with a JSON body, the browser first sends an OPTIONS request to ask permission. A server that has no route for OPTIONS answers it with a 405. The Fetch standard requires a successful preflight to have “an ok status, e.g., 200 or 204”, so the browser stops there, and what reaches the page is a CORS error rather than the 405. Look at the method column in the network panel: if the failed request says OPTIONS, this is the one.

Session Replay

Free Chrome extension. One click on the page that is misbehaving captures the screenshot, the console and the network log, and hands you a link to paste into the ticket.

Get the extension

If it is your site

Work through it in the order that costs least.

  1. Read the method column and the Allow header of the failed request in the network panel. Between them they usually name the mismatch.
  2. Look one row up. If the request before it is a 301 or 302 to almost the same address, the redirect changed the method. Point the form or the code at the final address, or make the redirect a 307 or 308, which keep the method.
  3. If the method is OPTIONS, teach the server to answer preflights for that route, with an ok status and the CORS headers, before looking at anything else.
  4. If the address serves a file, the form has nowhere to go. It needs an endpoint that handles POST, not a page.

Why it is hard to chase from a report

A 405 almost never reaches a bug report as a 405. The person who hit it saw a form that did nothing, a “Save” that failed, or a generic error the front end put up. If the cause was a preflight, the code itself saw a CORS error and logged that. The redirect case leaves no trace in the server’s error log either, because both requests were answered correctly.

What settles it is the sequence of requests with their methods and statuses, which is exactly what the reporter does not have unless something recorded it at the moment they clicked.

In one paragraph

A 405 means the address is right and the method is wrong. Read the Allow header, which the standard says must be there. Then check for the three causes that do not look like your code: a form posting to a static page, a 301 or 302 that turned a POST into a GET, and a preflight OPTIONS that the server did not handle. It is almost always the site’s to fix, and almost never the visitor’s.