
Quick Answer
Fix a Hypertext Transfer Protocol (HTTP) 405 response by checking the endpoint, request method, and response `Allow` header. Use the documented method, or add the missing route handler when you control the server. Inspect redirects, Cross-Origin Resource Sharing (CORS) preflight requests, gateways, and web-server rules when the method already appears correct.
Key Takeaways
- The method-resource pair matters: A valid method can still be unsupported for a specific resource.
- The `Allow` header guides diagnosis:cURL response headers can reveal which methods the resource supports.
- Headers do not set the request method:Sending request headers with cURL changes fields, although applications can interpret method overrides.
- Status codes separate causes:Proxy error codes distinguish method failures from authentication, rate-limit, and gateway problems.
- A proxy is not a method fix:Using cURL with a proxy can isolate routing differences without changing permissions.
- Server owners must trace the rejecting layer: Check application routes, gateways, web-server rules, and CORS handling.
- Repeated retries waste capacity: Treat 405 as a contract failure unless the response documents a temporary condition.
How Does HTTP 405 Differ From Similar Errors?
HTTP 405 means the method is known but rejected for the target resource, while neighboring status codes identify different faults. The response body may use a generic error template. Read the status, request method, target path, and response headers together.
| Status | What it means | First check |
|---|---|---|
| `403 Forbidden` | The server understands the request but refuses it | Authentication, authorization, or policy |
| `404 Not Found` | The server finds no current representation or will not disclose one | Address, route, and resource identifier |
| `405 Method Not Allowed` | The server knows the method, but the target resource rejects it | `Allow`, method, and route configuration |
| `415 Unsupported Media Type` | The server rejects the request content's format or coding | `Content-Type`, content coding, and body format |
| `501 Not Implemented` | The server lacks the functionality required for the request | Method spelling and server-wide support |
HTTP 404, 405, and 501 describe different conditions, not a continuum of how much the server recognizes. A 404 says no current representation was found, or the server will not disclose one.
A 405 confirms the server recognizes the method, but the target resource rejects it. A 501 means the server cannot support the method for any resource.
GET, POST, PUT, PATCH, and DELETE express different intended actions. Use the documented method, then investigate the rejecting layer if the same request still returns 405.
What Does HTTP 405 Method Not Allowed Mean?
HTTP 405 Method Not Allowed means the origin server recognizes the method, but the target resource currently rejects that method. Request for Comments (RFC) 9110, published in 2022, requires an origin server to include an `Allow` response header. That field lists the methods currently supported by the target resource.
A basic response can look like this:
An empty `Allow` value can indicate that the resource temporarily accepts no methods. The field can also appear in responses other than 405.
A 405 shows that one responding component rejected the method for the request target. It does not prove the intended application handler received the request.
A gateway, web server, framework, or application can generate the response first. Identify that component before changing a downstream application.
RFC 9110 describes 405 as heuristically cacheable unless the method definition or explicit cache controls say otherwise. A cached 405 can outlive a corrected deployment. Check intermediary and browser caches when live logs show success, but clients still receive the old response.
A 405 response without an `Allow` field does not comply with RFC 9110. The missing field deprives clients of the server's declared method set. Server owners should correct the response instead of forcing clients to infer supported methods.
HTTP method names are case-sensitive tokens. Standardized method names are conventionally uppercase.
Preserve the client's exact method because an unrecognized spelling can warrant 501 instead of 405. Compare the raw request line when available.
What Causes HTTP 405 Method Not Allowed?
HTTP 405 can result from a method-route mismatch, an unhandled preflight, a redirect, or an intermediary's method policy. An Application Programming Interface (API) client can also pair a documented method with an outdated path.
Deployed routing can differ from local source code. Compare the live route map before editing the client.
| Cause | Typical evidence | Correct direction |
|---|---|---|
| Client method mismatch | `Allow` excludes the method that was sent | Use the documented method for the intended action |
| Missing or stale route | The method works locally but fails after deployment | Compare the deployed route map and release version |
| Redirect behavior | The final request reaches another path or uses another method | Inspect every status and `Location` value |
| Failed CORS preflight | The 405 belongs to `OPTIONS`, not the intended request | Configure the exact preflight route and CORS policy |
| Intermediary restriction | Application logs contain no matching request | Inspect gateway, web-server, and security rules |
Malformed request syntax can produce 400, while unsupported content formats can produce 415. A syntactically valid body with unprocessable instructions can produce 422.
Custom software can use status codes incorrectly, so retain the response body and logs during diagnosis. Start with the method and route before editing unrelated fields.
A route can also differ by hostname, version prefix, path case, or trailing slash. One variant may allow POST, while another permits only GET. Compare the complete effective address instead of checking only the visible page name.
Security policies sometimes reject state-changing methods before the application runs. That behavior may be deliberate, or a deployment can carry an outdated restriction. Identify the responding layer before changing an application that never received the request.
How Do You Diagnose HTTP 405 With cURL?
Diagnose HTTP 405 by reproducing one request, preserving its method and path, and capturing the status, `Allow`, and `Location` fields. Change one variable per test so unrelated headers or route differences cannot hide the cause.
Use this sequence:
- Capture the baseline: Record the exact method, address, status, `Allow` field, response body, and request time.
- Confirm the target: Compare the scheme, hostname, port, version prefix, path case, query, and trailing slash.
- Preserve the operation: Reproduce the documented action instead of selecting another method merely because it succeeds.
- Inspect the first response: Test without automatic redirects so the original status and `Location` remain visible.
- Identify the responder: Compare gateway, web-server, and application logs using the same timestamp and correlation identifier.
- Change one input: Test one route, method, deployment, or policy change while keeping every other variable fixed.
- Validate the repair: Repeat the original request, then confirm the expected status, body, and side effect.
This Bash command reproduces a POST request and stores its response parts separately:
`--data` selects POST, while `--dump-header` preserves response headers and `--output` stores the body. `--disable` appears first so cURL skips its default configuration file. Replace the reserved example address with the endpoint under test, and never place live credentials in shared commands.
Do not substitute `-I` for this test. `-I` sends HEAD, which can create a different 405 response. Use `-i` or `--dump-header` when the failing operation uses GET or POST.
Verbose output can expose authorization fields, cookies, and other private values. Use `--verbose` only when needed, and redact its output before sharing it. Stop testing state-changing methods when their effects are uncertain.
How Do You Fix HTTP 405 in a Browser or Form?
Visitors can fix only client-side 405 causes; route definitions, server policies, and stale deployments require the website owner. A normal browser visit often uses GET, while a form can submit GET or POST. An outdated page can therefore send a valid method to a retired route.
Use the website's current interface before changing browser settings:
- Confirm the address: Open the website from its current navigation instead of an old bookmark or saved form.
- Reload once: Refresh the current page, then avoid repeated submissions that might duplicate a state-changing action.
- Repeat the intended path: Sign in again when required, reopen the current form, and submit it only once.
- Capture the failure: Save the visible message, complete address, time, and action that produced the response.
- Contact the owner: Provide those details when the current interface consistently returns 405.
A private window can help when a stale application bundle, extension, or service worker controls the request. Compare one private-window attempt with the ordinary session.
Do not keep retrying if the action creates orders, messages, payments, or account changes. Changing Domain Name System settings does not add a missing route handler.
Switching networks does not add that handler either. Clearing cookies can also remove useful session state without repairing the method policy.
Use those actions only when the website's support team identifies a separate session or caching problem. Follow the owner's instructions for any account-specific troubleshooting.
Visitors should not try PUT, PATCH, or DELETE merely because the server lists those methods. The `Allow` field describes support, not the action appropriate for a person. Only the website owner can repair a broken form target or deployed route.
How Do You Fix HTTP 405 in an API Client?
API clients fix HTTP 405 by matching the operation, exact route, version, and redirect behavior before changing credentials or payloads. The same path can expose different handlers for GET, POST, PUT, PATCH, and DELETE. Method support can also change between API versions.
Work through the client contract in order:
- Match the operation: Confirm the documented method performs the action you intend.
- Match the route: Copy the complete base address, version, resource path, identifiers, query, and trailing slash.
- Inspect `Allow`: Compare the advertised methods with the documentation, but do not choose one without matching its semantics.
- Check redirects: Capture the first response without following redirects. Request each expected hop separately, and record its method, status, and effective address.
- Rebuild the request: Configure the method through the client's documented option, then add the matching body and fields.
- Compare environments: Check development, staging, and production route versions without assuming their deployments match.
Request headers and bodies still matter after the correct handler is reached. However, a wrong media type should normally produce 415 rather than 405. Fix the method and route first, then diagnose content validation through the returned status and message.
Authentication failures also have different meanings. A destination can use 401 or 403, while an HTTP proxy can return 407. The HTTP 407 troubleshooting guide separates proxy credentials from destination authentication and routing.
Some systems intentionally mask route details, and custom gateways can return nonstandard statuses. Confirm which component generated the response before assuming the application chose it. Preserve correlation identifiers, but remove secrets from tickets and logs.
Use state-changing methods only on endpoints you control or are authorized to access. Never probe arbitrary resources with PUT, PATCH, or DELETE.
A successful request can alter or remove data even when the test body looks harmless. Run destructive tests only against disposable test data.
How Do You Fix HTTP 405 on a Server?
Server owners fix HTTP 405 by registering the handler and aligning every proxy, gateway, and policy layer with that route. Start from the deployed request path rather than the local route file. The first component returning 405 is the immediate investigation point.
Use this server-side sequence:
- Reproduce the failure: Send one sanitized request to a staging environment with matching configuration.
- Locate the rejection: Trace the request through the edge, gateway, web server, framework, and application logs.
- Compare route maps: Confirm the deployed handler accepts the intended method on the exact host and path.
- Review method policies: Inspect route guards, web-server restrictions, gateway rules, and web application firewall policies.
- Handle preflight requests: Ensure the relevant layer handles `OPTIONS` and returns required CORS fields for allowed browser origins.
- Return accurate guidance: Include an `Allow` field containing every method currently supported by that target resource.
- Deploy narrowly: Change only the affected route or policy, invalidate stale error caches, and retest the original operation.
If application logs contain no matching request, inspect an earlier layer. A reverse proxy or gateway may select a static handler or older service.
The intermediary may also apply a restrictive method policy. Compare its deployed configuration with the application route table before editing either system.
Apache HTTP Server provides one concrete policy example. Its official `mod_allowmethods` documentation says `AllowMethods` restricts methods and treats method names case-sensitively.
The documentation marks this module experimental, so verify its presence and scope before changing production configuration. Do not enable every method globally to remove one error.
Register only the handler required by the route, then apply authentication, authorization, validation, and logging. A correct 405 is safer than sending a destructive method to an unintended handler.
Return 405 when the method is known but not supported by the selected resource. Return another status when the failure concerns content, authentication, authorization, or resource lookup. Accurate responses shorten future diagnosis and prevent unsafe client workarounds.
How Do Redirects Cause HTTP 405?
Redirects cause HTTP 405 when clients change the method or repeat it against a destination that rejects the resulting method. Capture the first response separately because the visible 405 may belong to the destination instead of the original route.
HTTP 301 and 302 permit a user agent to change POST to GET when following a redirect. A 303 response tells the client to retrieve the new target with GET or HEAD. The redirected route still determines which methods it supports.
By contrast, 307 and 308 preserve the original method. A redirected POST can therefore reach a route that accepts only GET, producing 405.
The official cURL manual explains that `--location` follows redirects. It normally changes an automatically selected POST to GET after a 301, 302, or 303 response.
With `--location`, a method string set through `--request` remains unchanged across followed redirects. The option changes only the request word, not the behavior associated with that method. That combination can send an unintended method to a different route.
Start without `--location`, and capture the first status, `Location` field, and body. Confirm the next address and expected method before following each hop. This order preserves the evidence needed to explain a later 405.
Compare each request with server logs using a correlation identifier when available. Check whether the scheme, host, port, path, query, or method changes. This comparison identifies the first hop that returns 405.
A redirect that adds a trailing slash can reach a route with a different method map. Host canonicalization can create the same problem when another virtual host handles the redirected request.
Do not preserve a request body merely to force the original operation onto a new target. Keep the method and body only when the destination's contract accepts both.
When a state-changing operation should avoid redirects, configure the client to call the canonical endpoint directly. Retest the original request after changing the client address or redirect rule. A contract test should cover both the original and canonical addresses.
How Does CORS Cause HTTP 405?
A CORS preflight receives an HTTP 405 response when its `OPTIONS` request reaches a server route without a configured handler. The intended request may never run. Browser developer tools can reveal whether the preflight received the 405.
A browser can send a preflight before a cross-origin request that uses certain methods or fields. The request includes `Origin` and `Access-Control-Request-Method`, plus `Access-Control-Request-Headers` when needed.
The Mozilla CORS documentation describes these request fields and the corresponding response fields. Reproduce the browser's preflight with the same origin, method, and requested fields:
The relevant server layer must handle `OPTIONS` and return a CORS policy matching the allowed origin, method, and fields. `Allow` and `Access-Control-Allow-Methods` have different purposes. The first lists resource methods, while the second lists methods permitted by the browser-facing cross-origin policy.
cURL does not enforce browser CORS rules. A direct POST can succeed in cURL while the browser stops after a failed preflight.
A missing CORS response field can also cause a browser failure without producing HTTP 405. Inspect the preflight's status and response fields before changing route handling.
Fix the server's preflight route and CORS policy instead of disabling browser protections. Retest through the browser because a successful cURL transfer does not prove browser acceptance.
How Should You Handle HTTP 405 at Scale?
HTTP 405 handling at scale should stop blind retries, group failures by route and method, and reopen traffic after validation. Retry backoff helps with transient overload, but it does not create an absent handler. Uncontrolled retries add load and diagnostic noise without correcting a stable method mismatch.
| Control | Recommended behavior | Reason |
|---|---|---|
| Failure classification | Group failures by host, route, method, status, and deployment | Separates one broken contract from general outages |
| Retry policy | Do not retry 405 automatically without a documented change | Blind retries do not correct a route contract |
| Circuit control | Pause the affected route and method, not every destination | Healthy work can continue safely |
| Contract testing | Test supported methods and expected statuses before deployment | Route drift becomes visible before release |
| Response validation | Check the final status, body, and required side effect | Transport success does not prove application success |
| Cache handling | Invalidate retained 405 responses after a verified repair | Old error responses can hide the new deployment |
Queue workers should quarantine failed tasks with sanitized request metadata. Record the route template instead of sensitive identifiers whenever possible.
Attach the deployment version and responding layer so owners can compare failures with releases. Concurrency controls should operate per host and route.
One broken POST handler should not consume every worker through repeated attempts. Resume with a small canary batch, validate results, then restore the ordinary request rate.
Reliable web scraping with proxies still requires method accuracy, target-specific pacing, response checks, and bounded retries. Proxy rotation cannot repair a route contract. Keep the target host, path, and method fixed, then vary location only for a geographic comparison.
Track accepted results instead of completed network transfers. A completed transfer can still carry a 405 response. Alert on new route-method pairs, spikes in 405 responses, or `Allow` values that differ from the contract.
How Can Proxidize Help Test HTTP 405?
Proxidize can keep one network exit stable or support location-specific tests, but it cannot authorize a rejected HTTP method. The origin, gateway, or application still decides which methods each resource supports. Use a proxy only when the network exit or source location is a real test variable.
Proxidize supplies standard HTTP, HTTPS, and SOCKS5 connections with dashboard-managed credentials. Sticky sessions aim to keep one eligible exit for related comparisons. An upstream network can still replace that exit.
Rotating sessions select a new eligible exit for independent comparisons. Configure location targeting separately because rotation does not change the requested geography by itself.
Use protected environment variables and preserve the original method. The proxy scheme describes the proxy connection, while the destination retains its HTTPS scheme:
For this HTTPS destination, cURL first sends `CONNECT` to the HTTP proxy, then sends `GET` through the established tunnel. The `--dump-header` option can capture headers from both the proxy's tunnel response and the destination's response.
Add the documented destination method, body, and fields required by the diagnostic request. A 407 identifies required proxy authentication. For a 405, use the headers to identify which component rejected the method.
Best For: Residential Proxies fit global tests requiring country, city, or Internet service provider targeting.
Best For: Mobile Proxies fit tests that specifically require mobile-network context.
Use separate access points for unrelated projects so diagnostic usage remains attributable. Keep credentials out of source code and retained output. Command-line credential values may still appear briefly in local process listings.
Choose sticky or rotating behavior before collecting comparisons. Keep request pacing, method selection, and response validation inside the client. Record the access point, target location, session mode, and observed exit address beside each result.
What Should You Remember About HTTP 405?
HTTP 405 is fixed by aligning the request method with its exact target route or correcting the server-side method policy. The `Allow` field, exact path, and first response provide direct diagnostic evidence.
- HTTP 405 means the server recognizes the method, but the target resource does not support it.
- A compliant 405 response includes `Allow` with the target resource's currently supported methods.
- Methods listed in an `Allow` header do not reveal which operation matches the user's intent.
- cURL should reproduce the exact request without following redirects first, then inspect each hop separately.
- Server owners should trace the edge, gateway, web server, framework, and application before editing configuration.
- Failed CORS preflight requests require correct `OPTIONS` handling and matching access-control response fields.
- Proxies can isolate differences between network exits, but they cannot add a missing handler or grant method permission.
Frequently asked questions
HTTP 405 Method Not Allowed means the server recognizes the request method, but the selected resource does not support it. A compliant response includes an `Allow` header listing supported methods. The status does not prove which gateway, framework, or application layer generated it.
Confirm that POST is documented for the exact host, path, version, and trailing-slash form. Inspect the `Allow` header and any redirect before changing the body. If you own the server, register the POST handler and align every gateway or web-server policy with that route.
GET can return 405 when the selected resource supports another method, or an intermediary routes the request incorrectly. Verify the complete address and `Allow` value before changing anything. Server owners should confirm that the deployed GET handler matches the intended hostname and path.
HTTP 405 belongs to the 4xx client-error class, but either side can create the mismatch. A client may send the wrong method, or a server deployment may omit the intended handler. Diagnosis must compare the documented contract with the actual route and response.
HTTP 404 means the server found no current representation for the target, or chose not to disclose one. HTTP 405 means the server knows the request method but rejects it for that target resource. A compliant 405 also includes an `Allow` header.
A CORS preflight can receive 405 when a server, gateway, or web server does not handle `OPTIONS` for that route. The intended request may never run. Configure the preflight response for allowed origins, methods, and fields instead of disabling browser protections.
A proxy cannot add a server handler or grant permission for a rejected method. It can help compare specified network exits or source locations while keeping the target path fixed. Preserve the exact method and session during diagnosis, and do not rotate merely because one request returned 405.