DD
DevDash

HTTP 405 Method Not Allowed: What It Means and When You See It

Quick Answer

HTTP 405 Method Not Allowed means the HTTP method (GET, POST, PUT, etc.) is not allowed for the requested URL. The Allow header lists the permitted methods.

When HTTP 405 Occurs

HTTP 405 is returned when the HTTP method used is not supported for the requested URL. The response must include an Allow header listing the supported methods: Allow: GET, POST, HEAD. Common causes: sending a DELETE request to an endpoint that only accepts GET/POST, sending a PUT to a read-only endpoint, using GET instead of POST for a form submission endpoint, and calling a REST API with the wrong verb (PATCH vs PUT, POST vs GET). In Next.js App Router, API routes are defined per-method - calling with POST when only GET is defined returns 405. In Express, each route handler is method-specific - if you only define app.get("/users"), a POST /users returns 404 unless you add a catch-all.

405 vs 404 vs 501

HTTP 404 Not Found means the resource does not exist at all. HTTP 405 Method Not Allowed means the resource exists but does not support the method. HTTP 501 Not Implemented means the method is not supported by the server globally (rare). Use 405 when: the URL is valid and the resource exists, but the specific HTTP verb is not handled. Example: GET /users/123 returns the user (200). DELETE /users/123 returns 405 if deletion is not supported. If the URL does not exist at all, use 404 regardless of method.

Fixing HTTP 405 Errors

For API clients: check the API documentation for supported methods. Use the Allow header in the 405 response to see what methods are valid. Use an OPTIONS request to discover supported methods: curl -X OPTIONS https://api.example.com/users. For API developers (Express): ensure all required HTTP methods are registered. Add a catch-all method handler: app.all("/endpoint", (req, res, next) => { if (!["GET", "POST"].includes(req.method)) return res.status(405).set("Allow", "GET, POST").json({ error: "Method not allowed" }); next(); }). In Next.js, unhandled methods automatically return 405 with the correct Allow header.

Try the interactive tool

Convert any value instantly — no sign-up required

Open tool →

Frequently Asked Questions

Related Values

Want API access + no ads? Pro coming soon.