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

The HTTP 405 Method Not Allowed status code indicates that the HTTP method used in the request (e.g., GET, POST, PUT, DELETE) is known by the server but is not supported for the target resource. This means the server understands the method but the specific resource doesn't allow that operation.

Last updated: 2026-06-11

RECOMMENDED

Essential Reading: Designing Data-Intensive Applications

The system design bible for software engineers. Learn to build reliable, scalable, and maintainable systems.

View on Amazon →
Status Code 405
Name Method Not Allowed

Common Causes

  • Attempting to use a POST request on a resource that only accepts GET requests (e.g., a static file).
  • Trying to DELETE a resource that is not designed to be deleted via the API.
  • Misconfiguration of the web server (e.g., Apache, Nginx) or application framework (e.g., Express, Django) where a route is defined but doesn't explicitly allow certain HTTP methods.
  • Using an incorrect HTTP method for a RESTful API endpoint (e.g., sending a PUT to create a resource when POST is expected).

Code Examples to Handle HTTP 405

curl -I https://httpbin.org/status/405

How to Fix It

  1. Review the API documentation or server configuration to determine which HTTP methods are allowed for the specific resource path.
  2. Verify the HTTP method being sent in your client-side request (e.g., check your fetch, axios, or form submission method).
  3. If you control the server, check your routing definitions and ensure that the desired HTTP method is explicitly allowed for the endpoint in question.
  4. Examine server-side logs for more detailed error messages that might indicate why the method was disallowed.
💡 Example: A user tries to submit a form on a website using a POST request, but the server-side endpoint for that form is only configured to accept GET requests for displaying data, not for processing submissions. The server responds with a 405 Method Not Allowed.
🛠️ Developer Tip: Always consult your API documentation or server-side routing definitions to understand the expected HTTP methods for each endpoint. Providing an 'Allow' header in the 405 response can greatly assist clients in understanding which methods are permitted.

Related Status Codes

Frequently Asked Questions

What causes HTTP 405?

HTTP 405 occurs when the server understands the HTTP method you used in your request (like GET, POST, PUT), but that specific method is not permitted for the resource you are trying to access. It's often due to incorrect client-side requests or server-side routing misconfigurations.

How do I fix HTTP 405?

To fix a 405 error, first check your client-side code to ensure you're sending the correct HTTP method. Then, consult the API documentation or server-side routing to confirm which methods are allowed for the resource. If you control the server, adjust your route definitions to permit the intended HTTP method.