The HTTP method used in the request is not supported for the target resource.
The HTTP method used in the request is not supported for the target resource. The server knows the method (GET, POST, PUT, DELETE, etc.) but the resource doesn't accept it. For example, trying to POST data to a resource that only supports GET. The server must include an Allow header in the response listing the methods that are supported.
A 405 error occurs when you send a request using an HTTP method that the server's routing configuration doesn't allow for that specific endpoint. This is most common in REST API development where each endpoint explicitly defines which methods it supports.
For example, a /users endpoint might support GET (list users) and POST (create user), but return 405 if you try PUT or DELETE on it. The 405 is different from 404 because the resource exists - it just doesn't support the method you used.
Platform-Specific Notes:
Nginx Returns 405 with the limit_except directive. By default, static files only allow GET and HEAD. Use error_page 405 =200 $uri; as a workaround.
Apache Uses <Limit> and <LimitExcept> directives to control allowed methods per directory or location.
Cloudflare Passes through the origin's 405 response. Cloudflare Workers can intercept and handle specific methods.
Node.js Express returns 405 implicitly when no route handler matches the method. Use app.all() to catch all methods on a route.
Allow header listing supported methodsAccess-Control-Allow-Methods and handle OPTIONS preflight# Trying to POST to a GET-only endpoint POST /api/users/123 HTTP/1.1 Host: api.example.com Content-Type: application/json {"name": "Updated Name"} # Server Response (only GET and PUT are allowed) HTTP/1.1 405 Method Not Allowed Allow: GET, PUT, HEAD, OPTIONS Content-Type: application/json { "error": "Method Not Allowed", "message": "POST is not supported for /api/users/123. Use PUT to update.", "allowed_methods": ["GET", "PUT", "HEAD", "OPTIONS"], "statusCode": 405 }
Allow header in the 405 response. Per the HTTP specification (RFC 7231), the server must include an Allow header listing the supported methods for the resource (e.g., Allow: GET, HEAD, OPTIONS). You can also send an OPTIONS request to the endpoint, which should return the allowed methods in the response. Most API documentation also lists supported methods for each endpoint.Detect method configuration errors across your API endpoints. Get alerted when routing changes break your integrations.
Start Free Monitoring