Scrapeless Wiki

HTTP 405 Method Not Allowed – What It Means and How to Fix It

Troubleshooting P2 http 405 meaning

Learn what HTTP 405 Method Not Allowed means, why the method rather than the URL is wrong, how the Allow header helps, and how to fix it.

A 405 says the resource exists but does not accept the verb you used. It is one of the more precise errors on the web: the path is right, the method is not.

1. What Does HTTP 405 Mean?

The server recognised the request target and rejected the method for it.

  • The URL is valid. A wrong path returns 404, not 405.
  • The method is the problem. POST to a read-only endpoint, GET to one that only accepts POST.
  • The response should tell you what is allowed. The specification requires an Allow header listing acceptable methods.
HTTP/1.1 405 Method Not Allowed
Allow: GET, HEAD, OPTIONS

2. Common Causes

  • Sending POST where GET is expected, or the reverse β€” often after copying a snippet from different documentation.
  • A client library defaulting to POST when a body is supplied, even for a read endpoint.
  • A redirect changing the method. Some redirect codes historically convert POST to GET; a chained redirect can arrive with the wrong verb.
  • Preflight not handled. A cross-origin request triggers OPTIONS, and a server that does not implement it answers 405.
  • Static hosting. Object storage and static file hosts accept only read methods.
  • API version drift. An endpoint that once accepted PUT now expects PATCH.

3. How to Diagnose It

Read the Allow header first β€” it usually resolves the problem immediately.

curl -i -X OPTIONS "https://api.example.com/v1/items"

If the header is absent, check the documentation for that exact path, and confirm whether your client followed a redirect that may have altered the method.

4. How to Fix It

Cause Fix
Wrong verb Use a method from the Allow header
Library adds a body Send the parameters as a query string on a GET
Redirect changed the method Request the final URL directly
Preflight unhandled Implement OPTIONS on the server with CORS headers
Static host Use the API endpoint, not the storage URL
  • 404 β€” the resource does not exist. 405 means it does.
  • 501 β€” the server does not implement the method at all, anywhere.
  • 403 β€” the method is allowed but you may not use it here.
  • 400 β€” the method is fine and the request itself is malformed.

That distinction from 403 matters: 405 is about the verb, 403 about permission.

6. Real-World Examples

  • A GET request to a search endpoint that requires a POST body.
  • A browser preflight failing because OPTIONS is not routed.
  • A DELETE rejected by a proxy that only forwards read and write verbs.
  • A POST to a static file URL rather than to the API that manages it.

7. Summary

HTTP 405 means the path was found and the method refused. The Allow header names the acceptable verbs and is the fastest route to a fix.

Check the method before doubting the URL, watch for redirects and client libraries that change it implicitly, and remember that a missing OPTIONS handler is the usual cause when the failure only appears from a browser.