HTTP

405 Method Not Allowed

The URL exists, but not for the HTTP method you used (GET/POST/PUT/…).

What it looks like

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

What does "405 Method Not Allowed" mean?

Returned when the URL exists but does not accept the HTTP method you used. The Allow response header lists the methods that would work, which usually points straight at the mistake.

What causes "405 Method Not Allowed"?

  • Sending POST to a GET-only route (or vice-versa).
  • A trailing-slash redirect downgraded the method.
  • CORS preflight OPTIONS not allowed.

How do I confirm the cause?

  1. Read the Allow header in the response to see which methods the route accepts.
  2. Check for a redirect first: many servers turn a POST into a GET when they redirect (for example to add a trailing slash), and the GET then fails.
  3. If the failing request is OPTIONS, it is a CORS preflight the server has not been told to answer.
  4. For HTML forms, check the form tag: a form without method="post" submits as GET.

How do I fix "405 Method Not Allowed"?

  • Use the method the endpoint expects.
  • Check the route definition's allowed methods.
  • Allow OPTIONS for CORS preflight.

How do I stop it happening again?

  • Call the exact canonical URL, including any trailing slash, so no redirect changes the method.
  • Define the allowed methods explicitly in your routes and answer OPTIONS for any route called cross-origin.
Got a different error? Paste it into the Explain This Error tool → Identifies the family and the fix — runs locally, nothing uploaded.

Related errors