HTTPError.net

The fastest way to diagnose, understand, and fix any HTTP status code

405 Method Not Allowed

Fault: Client
TL;DR

HTTP method (GET, POST, etc.) not allowed for this endpoint.

The request method is not supported for the requested resource.

What HTTP 405 Method Not Allowed Means

The request method is not supported for the requested resource.

HTTP method (GET, POST, etc.) not allowed for this endpoint.

Common Causes

How to Fix It (For Visitors)

How to Fix It (For Developers/Admins)

Returning a 405 Method Not Allowed (Code Examples)

If you build APIs or web apps, here is how to send an HTTP 405 response and how to test for it:

Node.js (Express)

app.get('/resource', (req, res) => {
  res.status(405).json({ error: 'Method Not Allowed' });
});

Python (Flask)

@app.route('/resource')
def resource():
    return jsonify(error='Method Not Allowed'), 405

PHP

<?php
http_response_code(405);
header('Content-Type: application/json');
echo json_encode(['error' => 'Method Not Allowed']);

Check the status with curl

curl -I https://example.com/resource
# Look for: HTTP/1.1 405 Method Not Allowed

Frequently Asked Questions

What does HTTP 405 Method Not Allowed mean?

HTTP method (GET, POST, etc.) not allowed for this endpoint. In short: The request method is not supported for the requested resource.

Is 405 Method Not Allowed a client or server error?

405 is a 4xx client-error code, so the request itself needs to change. The server is running normally and is rejecting the request as it was sent by the browser, app, or API client.

How do I fix a 405 Method Not Allowed error?

Check API documentation for allowed methods. Verify HTTP method in request. Add Allow header in response.

Official Specification

The 405 Method Not Allowed status code is defined in RFC 7231 Section 6.5.5.

View the IANA HTTP Status Code Registry →