405 Method Not Allowed means the server recognizes the HTTP method (GET, POST, PUT, DELETE and so on), but the URL you requested does not accept that method. The resource usually exists; the request verb, the route definition, a redirect, or a security layer in front of the app does not match. A correct 405 response includes an Allow header that lists the methods the resource does accept.
Quick checks
- Find the exact method and URL that fail in the browser DevTools Network tab or in your API client.
- Run
curl -i -X POST https://example.com/endpoint(use the failing method) and read theAllowheader in the response. - Check whether the request is redirected first:
curl -I http://example.com/endpointshowing a301or302means the method may be lost on the way. - Look at the
serverheader and the error page: a Cloudflare, NGINX or ModSecurity page means the block happens before the application. - Think about what changed right before the error: a deployment, a plugin update, new WAF rules, or a CORS change.
What Is 405 Method Not Allowed?
405 Method Not Allowed is an HTTP client error response. It means the request method is recognized by the server, but not supported by the target resource.
This is different from several similar errors:
- 404 Not Found means the resource itself cannot be found.
- 403 Forbidden means access is understood but denied.
- 501 Not Implemented means the server does not support the method at all.
- 405 Method Not Allowed means the server knows the method, but that specific URL does not allow it.
A normal 405 response returns an Allow header showing which methods the resource actually accepts:
HTTP/1.1 405 Method Not Allowed
Allow: GET, POST, HEADIf that header is missing, the response is probably coming from a proxy, WAF or custom error handler rather than from the application route itself.
Causes and fixes
1. The client sends the wrong HTTP method
How to check: Compare the method in the DevTools Network tab (or your API client log) with the endpoint documentation. Then send the documented method directly:
curl -i -X POST https://example.com/api/v1/items \
-H "Content-Type: application/json" -d '{"name":"test"}'If the documented method succeeds and yours returns 405 with an Allow header that does not include it, the client is using the wrong verb, for example PUT where the API only accepts PATCH, or GET where it expects POST.
How to fix: Change the method in the client code, for example fetch(url, { method: 'PATCH', ... }), the webhook settings, or the API client. Also check the exact path and version: /v1/ versus /v2/ and a missing or extra trailing slash can route the request to a resource that does not accept the method.
2. The route exists but has no handler for that method
How to check: List the registered routes in your framework and look at the methods next to the failing path:
# Laravel
php artisan route:list --path=api/items
# Symfony
php bin/console debug:router
# Django REST Framework / Express: check the view's allowed methods or app.get/app.post definitionsIf the path is registered only for GET, a POST to it returns 405. The application log usually shows a MethodNotAllowedHttpException or a similar router error.
How to fix: Register the missing method on the route (for example Route::post('/api/items', ...) or Route::match(['get','post'], ...)) and add the controller method. Clear the route cache after deploying, for example php artisan route:clear.
3. An HTML form posts to the wrong URL or with the wrong method
How to check: Inspect the form element and compare its method and action attributes with what the backend expects. In the Network tab, submit the form and confirm which URL actually receives the request. A form with no method attribute sends GET.
How to fix: Set the method and target explicitly:
<form method="post" action="/contact/submit/">Make sure the action points to the URL that processes the submission, not to a page that only displays content. On static hosting, form posts to an .html page return 405 because static files cannot receive POST; send the form to a script or form service instead.
4. A redirect changes the request
How to check: Follow the request without letting the client hide redirects:
curl -i -X POST http://example.com/contact/submitA 301 or 302 response here is the problem: most clients repeat the request as GET after those codes, and the target URL may not accept it, or a POST-only endpoint receives a GET. Common triggers are HTTP to HTTPS, www to non-www, and trailing-slash redirects.
How to fix: Point forms and API clients at the final URL (HTTPS, correct host, correct trailing slash) so no redirect happens. If a redirect must stay for a POST endpoint, use 307 or 308, which keep the original method and body.
5. Apache or NGINX restricts the method
How to check: Search the configuration for method restrictions:
# Apache
grep -rniE "LimitExcept|<Limit |AllowMethods" /etc/apache2/ /etc/httpd/ .htaccess 2>/dev/null
# NGINX
grep -rniE "limit_except|request_method" /etc/nginx/Also check the error page: NGINX returns its own 405 page when a POST reaches a location that serves static files without passing the request to PHP or an upstream.
How to fix: Remove or widen the restriction, for example limit_except GET POST { deny all; } must also list PUT, PATCH or DELETE if your API uses them. Make sure the location handling the endpoint passes requests to the application (fastcgi_pass or proxy_pass), then test and reload: sudo nginx -t && sudo systemctl reload nginx or sudo apachectl configtest && sudo systemctl reload apache2.
6. CORS preflight (OPTIONS) is not handled
How to check: In the Network tab, look for an OPTIONS request just before the failing call. Reproduce it:
curl -i -X OPTIONS https://api.example.com/v1/items \
-H "Origin: https://app.example.com" \
-H "Access-Control-Request-Method: PUT"A 405 here, or a response without Access-Control-Allow-Methods, means the preflight fails and the browser never sends the real request.
How to fix: Handle OPTIONS on the route or with CORS middleware, and return Access-Control-Allow-Origin, Access-Control-Allow-Methods and Access-Control-Allow-Headers. Make sure the proxy, API gateway and WAF let OPTIONS through to the application.
7. A WAF, ModSecurity or security plugin blocks the method
How to check: Look for the blocked request in the security logs: Cloudflare Security → Events, the ModSecurity audit log (often /var/log/modsec_audit.log or the hosting panel’s ModSecurity section), or the activity log of your WordPress security plugin. Requests using PUT, PATCH, DELETE or OPTIONS are blocked most often.
How to fix: Add an exception for the specific endpoint or rule ID instead of disabling the firewall globally. Pause the security plugin briefly to confirm it is the cause, then whitelist the route in its settings.
8. WordPress REST API or plugin endpoint rejects the method
How to check: Test the endpoint directly:
curl -i -X POST https://example.com/wp-json/wp/v2/postsA JSON body with "code":"rest_no_route" means no route matches that URL and method. A 401 or 403 instead means the route is fine and authentication is the issue. If the 405 comes back as an HTML page, the web server or a firewall answered before WordPress.
How to fix: Use the method the route registers (the plugin’s register_rest_route() call defines it with 'methods' => 'POST' or similar). Re-save permalinks in Settings → Permalinks if /wp-json/ URLs fail, exclude /wp-json/ from page caching, and update or replace the form or plugin that posts to a removed endpoint.
General troubleshooting
- Read access and application logs together: the access log shows the method, URL and status (
"POST /api/items HTTP/1.1" 405); the application log shows why it was rejected. - 405 vs 501: 405 means the method is known but not allowed on this resource; 501 means the server does not implement the method at all.
- Review recent changes: new routes, server config, proxy deployments, plugin updates, WAF hardening, CORS or API version changes cause most new 405 errors.
Prevention Tips
- Document allowed methods for each route clearly.
- Keep frontend forms and API docs aligned with backend routing.
- Test
OPTIONS,POST,PUT, andDELETEafter deployments. - Review WAF and security rules before blocking non-GET methods broadly.
- Be careful with redirects around forms, APIs, and admin pages.
- Use consistent API versioning and route conventions.
- Check server and proxy rules whenever methods suddenly stop working.
The best prevention is simple: make sure the route, the method, the proxy layer, and the security layer all agree on what is allowed.
When to Contact Support
Contact your developer or backend team if:
- the route exists but the method is not handled correctly,
- API docs and backend behavior do not match,
- the issue started after code deployment.
Contact your hosting provider or server admin if:
- Apache or NGINX may be blocking the method,
- reverse proxy rules are involved,
- firewall or WAF behavior may be interfering.
Focus on WordPress/plugin troubleshooting if:
- the issue started after a plugin update,
- forms or REST API endpoints are affected,
- security plugins or caching layers are installed.
Related 4xx errors: 400 Bad Request, 401 Unauthorized, 404 Not Found, and 413 Request Entity Too Large.
FAQ
What does 405 Method Not Allowed mean?
It means the server understands the HTTP method, but the specific resource you requested does not allow that method.
What is the difference between 405 and 404?
404 means the resource is not found. 405 means the resource exists, but the method used for the request is not allowed there.
How do I fix 405 Method Not Allowed fast?
Check which HTTP method is being used, inspect the Allow header, verify the route supports that method, then review server rules, proxies, security layers, and recent changes.
Can CORS cause a 405 error?
Yes. If the browser sends a preflight OPTIONS request and the server or proxy does not handle it correctly, you can get a 405 before the real request is even sent.
Can WordPress cause a 405 error?
Yes. Security plugins, REST API restrictions, broken permalinks, caching, contact form plugins, and server security rules can all trigger 405 errors on WordPress sites.
Related HTTP Errors
Hi, I’m Alex — the person behind ErrorRescue.
I’ve been working with websites, servers, and hosting for over 8 years. Most of my experience comes from troubleshooting real problems on WordPress sites, VPS and shared hosting environments, and Cloudflare setups. I’ve dealt with everything from SSL certificate failures and DNS misconfigurations to 504 timeouts, memory exhaustion errors, and Cloudflare 5xx issues.
I started ErrorRescue because I got tired of seeing generic, outdated, or incomplete error guides. My goal is to write clear, practical fixes based on what actually works in production — not just theory. Every guide here is tested against common server setups (Apache, NGINX, Cloudflare, and popular WordPress stacks).
When I’m not fixing sites, I’m usually reviewing new hosting configurations or updating existing guides so they stay accurate.