HTTP 405 Method Not Allowed — Reverse Proxy & Gateway Troubleshooting
HTTP 405 Method Not Allowed indicates that the target URL exists, but the server refuses the specific HTTP verb used (such as POST, PUT, DELETE, or browser CORS OPTIONS preflight) and returns an Allow header listing permitted methods.
| Status Code | 405 Method Not Allowed |
|---|---|
| Specification / Origin | RFC 9110 ยง15.5.6 |
| Failure Layer | API Router / CORS Preflight |
| Retry Safety | Do not blind-retry without fixing request syntax, auth, or origin certificate |
Interactive HTTP 405 Live Probe & Log Command Builder
Enter your target endpoint below to generate copy-ready curl latency breakdown probes and origin bypass tests:
Related diagnostics: Nginx & Caddy Proxy Generator → · X.509 SSL Certificate Decoder → · Offline JWT Expiry Inspector →
Production Root Causes & Remediation Guide
Static web servers (Nginx, Cloudflare Pages, S3) return 405 when a frontend form or webhook sends POST requests to a static HTML route because an API proxy prefix was misrouted, or when an API gateway lacks an explicit OPTIONS handler for CORS preflights.
Step-by-Step Engineering Fix
Route /api/ traffic to the dynamic backend upstream before static catch-all rules, and return fast 204 No Content responses with Access-Control-Allow-Methods for browser OPTIONS preflight checks.
Recommended Nginx / Reverse-Proxy Configuration Snippet
if ($request_method = OPTIONS) {
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS";
return 204;
}
Frequently Asked Questions (HTTP 405)
Why do browser fetch() calls fail with 405 on cross-origin POST requests?
Browsers send an automatic OPTIONS preflight request before cross-origin JSON POSTs; if the reverse proxy or router only registers POST and rejects OPTIONS, preflight fails with 405.
Which infrastructure layer generates HTTP 405 Method Not Allowed?
HTTP 405 (RFC 9110 ยง15.5.6) typically originates at the API Router / CORS Preflight layer. HTTP 405 Method Not Allowed indicates that the target URL exists, but the server refuses the specific HTTP verb used (such as POST, PUT, DELETE, or browser CORS OPTIONS preflight) and returns an Allow header listing permitted methods.
Should API clients automatically retry HTTP 405 responses?
Do not blind-retry HTTP 405 without fixing the underlying request payload, authentication token, or origin TLS certificate first.
Browse All 25 Gateway, Proxy & Cloud HTTP Error Guides
HTTP 400 (Bad Request) HTTP 401 (Unauthorized) HTTP 403 (Forbidden) HTTP 404 (Not Found) HTTP 405 (Method Not Allowed) HTTP 408 (Request Timeout) HTTP 413 (Content Too Large) HTTP 422 (Unprocessable Content) HTTP 429 (Too Many Requests) HTTP 431 (Request Header Fields Too Large) HTTP 499 (Client Closed Request) HTTP 500 (Internal Server Error) HTTP 501 (Not Implemented) HTTP 502 (Bad Gateway) HTTP 503 (Service Unavailable) HTTP 504 (Gateway Timeout) HTTP 507 (Insufficient Storage) HTTP 511 (Network Authentication Required) HTTP 520 (Web Server Returned an Unknown Error) HTTP 521 (Web Server Is Down) HTTP 522 (Connection Timed Out) HTTP 523 (Origin Is Unreachable) HTTP 524 (A Timeout Occurred) HTTP 525 (SSL Handshake Failed) HTTP 526 (Invalid SSL Certificate)