HTTP 405 Method Not Allowed

Right address, wrong verb: the resource exists but does not accept this HTTP method.

What HTTP 405 means

HTTP 405 Method Not Allowed means the server recognizes the URL but the HTTP method — GET, POST, PUT, DELETE — is not supported for it. The response must include an Allow header listing the methods that are supported.

It is almost always a mismatch between client and API: a form POSTing to a page route, a script sending PUT where the API expects PATCH, or a webhook configured with the wrong method.

Common causes of 405 errors

  • POST sent to an endpoint that only handles GET (or vice versa) — typical after copy-pasting API examples.
  • A redirect (301/302) converted a POST into a GET before the request reached the endpoint.
  • The web server blocks methods like PUT/DELETE globally while the app expects them.
  • A wrong route: the intended endpoint is /api/items (POST), but the request hit /items.

How to fix it as a developer

  • Read the Allow response header — it lists exactly which methods the URL accepts.
  • Check API documentation for the correct method and path pair.
  • If a redirect is in the path, use 307/308 so the method survives the hop.
  • On the server, ensure the framework route declares the method and no proxy strips it.

Example response

HTTP/1.1 405 Method Not Allowed
Allow: GET, HEAD
Content-Type: application/json

{"error":"method_not_allowed"}

FAQ

How do I see which methods a URL supports?

Check the Allow header on the 405 response, or send an OPTIONS request to the URL.

Why did my POST turn into GET?

A 301 or 302 redirect in between let the client switch methods. Use 307/308 redirects for endpoints that accept POST.

Is 405 a client or server problem?

Formally a client error, but it often exposes a server misconfiguration — a route missing a method or a proxy blocking verbs.