Start free · Free tools · Fair usage limits
Browse Tools

Categories

Custom AI Solutions – AI2Flows
LIVE NEWS
Loading latest AI & SEO news…
Home›Tools›HTTP Status Codes Reference›HTTP 405 Method Not Allowed
4xx Client Error

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 code405
NameMethod Not Allowed
Class4xx Client Error
Defined inRFC 9110 §15.5.6
Cacheable by defaultYes (heuristically cacheable)
Safe to retry automatically?No: change the request first
Related headersAllow

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?

  1. Add the missing method handler, or send the correct method.
  2. Handle OPTIONS for CORS preflight requests.
  3. 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.

Frequently asked questions

Why does my form submission return 405?
The form posts to a URL that only accepts GET, often a static page or a CDN-hosted file. Point the form action at an endpoint that handles POST.
405 on OPTIONS requests?
Your API does not handle CORS preflight. Add an OPTIONS handler (or CORS middleware) that returns the allowed methods and headers.
Is 405 a client or server error?
405 is in the 4xx class, so it is classed as a client error: the request needs to change before it can succeed.