HTTP method override: boundaries when POST represents another action
Method override is an application compatibility convention: a client sends POST plus a header or parameter, and server middleware interprets the request as PUT, PATCH, or DELETE. It is not a behavior guaranteed by HTTP intermediaries. Prefer sending the actual HTTP method when the client supports it.
Method override is an application compatibility convention: a client sends POST plus a header or parameter, and server middleware interprets the request as PUT, PATCH, or DELETE. It is not a behavior guaranteed by HTTP intermediaries. Prefer sending the actual HTTP method when the client supports it.
For example, Express's method-override middleware reads X-HTTP-Method-Override by default and checks overrides only on original POST requests by default. This is Express package behavior, not a universal default. The on-wire method remains POST; middleware changes the method seen by the router. (Express method-override docs)
POST /resources/42 HTTP/1.1
X-HTTP-Method-Override: DELETE
Content-Type: application/x-www-form-urlencodedUse this only for clients with a real method limitation, such as a legacy form. If clients and proxies can send DELETE directly, use it. An intermediary sees POST while the application may route the request as DELETE; cache, CSRF, authorization, routing, and audit behavior can then disagree. Express warns that allowing more original methods can create security issues and unexpected cache behavior. (Express docs)
Configure it narrowly
Prefer the native HTTP method whenever possible.
Accept one documented override source; do not allow a header, query parameter, and body field to compete.
Read overrides only on `POST`; do not enable arbitrary source methods.
Allow only methods the route actually supports, and reject unknown or forbidden values.
Run the override before routing, CSRF checks, authorization, or other middleware whose policy depends on the effective method. For a body-field convention, parse the body first with strict size and media-type limits.
Record both the original wire method and the effective method in diagnostics without logging sensitive body data or credentials.
Verify the request path
Check that an allowed POST reaches exactly the intended handler; override headers on GET and unsupported methods are rejected or ignored; duplicate or malformed headers do not produce different interpretations across layers; CSRF and access checks cover the effective destructive action; and the deployed proxy/cache path handles the POST-versus-effective-method distinction safely.
These are proposed checks, not test results from a particular service. If every layer cannot apply the convention consistently, do not use method override; use a native method or a clearly defined action endpoint instead.
References
[RFC 9110: HTTP Semantics](https://www.rfc-editor.org/rfc/rfc9110.html)
[Express: method-override middleware](https://expressjs.com/en/resources/middleware/method-override.html)