HTTP 405 Method Not Allowed
HTTP 405 Method Not Allowed means the URL exists but does not support the HTTP method used, for example a POST to a read-only page or a GET to an endpoint…
Quick answer
HTTP 405 Method Not Allowed means the URL exists but does not support the HTTP method used, for example a POST to a read-only page or a GET to an endpoint that only accepts POST. The server must include an Allow header listing the supported methods.
Last updated · Maintained by FreeAIToolz · How we test
What does HTTP 405 Method Not Allowed mean?
A 405 confirms the resource exists (otherwise it would be 404). It frequently appears when a form posts to a static host, when a framework route only defines one method, or when CORS preflight (OPTIONS) is not handled.
| Status code | 405 |
|---|---|
| Name | Method Not Allowed |
| Class | 4xx Client Error |
| Defined in | RFC 9110 §15.5.6 |
| Cacheable by default | Yes (heuristically cacheable) |
| Safe to retry automatically? | No: change the request first |
| Related headers | Allow |
What causes HTTP 405?
- Sending POST to a static file or a GET-only route.
- OPTIONS preflight not handled by the API.
- A web server configuration that disables PUT or DELETE.
How do I fix HTTP 405?
- Add the missing method handler, or send the correct method.
- Handle OPTIONS for CORS preflight requests.
- Return an Allow header listing valid methods.
What should a client do after HTTP 405?
Change the method; retrying the same request will fail again.
Does HTTP 405 affect SEO?
Rarely matters for SEO, since crawlers use GET. If a public page returns 405 for GET, it will not be indexed.
Example 405 response
HTTP/1.1 405 Method Not Allowed
Date: Mon, 01 Dec 2026 12:00:00 GMT
Allow: GET, HEAD
Content-Type: application/json
{"error":{"status":405,"message":"Method Not Allowed"}} How to return 405 Method Not Allowed in code
Express (Node.js)
res.status(405).json({ error: 'Method Not Allowed' }); Next.js route handler
return Response.json({ error: 'Method Not Allowed' }, { status: 405 }); FastAPI (Python)
raise HTTPException(status_code=405, detail="Method Not Allowed") PHP
http_response_code(405); Nginx
location = /example {
return 405;
} Other 4xx status codes
The request contains an error or cannot be fulfilled as sent. Fix the request before retrying.
- 400 Bad Request
- 401 Unauthorized
- 402 Payment Required
- 403 Forbidden
- 404 Not Found
- 406 Not Acceptable
- 407 Proxy Authentication Required
- 408 Request Timeout
- 409 Conflict
- 410 Gone
- 411 Length Required
- 412 Precondition Failed
- 413 Content Too Large
- 414 URI Too Long
- 415 Unsupported Media Type
- 416 Range Not Satisfiable
- 417 Expectation Failed
- 418 I'm a teapot
- 421 Misdirected Request
- 422 Unprocessable Content
- 423 Locked
- 425 Too Early
- 426 Upgrade Required
- 428 Precondition Required
- 429 Too Many Requests
- 431 Request Header Fields Too Large
- 451 Unavailable For Legal Reasons
- 499 Client Closed Request
Frequently asked questions
Why does my form submission return 405?
405 on OPTIONS requests?
Is 405 a client or server error?
Related
- 404 Not Found HTTP 404 Not Found means the server cannot find anything at the requested URL.
- 501 Not Implemented HTTP 501 Not Implemented means the server does not support the functionality needed to fulfil the request, mos.
- 400 Bad Request HTTP 400 Bad Request means the server cannot process the request because of a client error, such as malformed .
- 403 Forbidden HTTP 403 Forbidden means the server understood the request but refuses to allow it.
- Open the HTTP Status Codes Reference → Free, no signup.