Back to all status codes
405

Method Not Allowed

The request method is not supported for the requested resource.

Common Causes

  • POST to GET-only endpoint
  • Using wrong HTTP method
  • API method mismatch

Fix Solutions

Use correct HTTP method

Check API documentation for the correct method (GET, POST, PUT, DELETE, etc.).

Code Examples

# Allow only specific methods
location /api {
    if ($request_method !~ ^(GET|POST)$) {
        return 405;
    }
}

Related Tools