Overview

What you're trying to do isn't valid.

Takeaways

  1. The method received in the request-line is known by the origin server but not supported by the target resource.
  2. The origin server must generate an Allow header field in a 405 response containing a list of the target resource's currently supported methods.

Information

A 405 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls.

Further Reading

Specification

405 Method Not Allowed | The HTTP Working Group

405 Method Not Allowed

MDN web docs

Allow header field

MDN web docs