Find answers, guides, and tutorials to supercharge your content delivery.

405 Method Not Allowed

Updated on October 4, 2018
405 Method Not Allowed

What does a 405 Method Not Allowed error mean?

The HTTP protocol uses what is called methods in order to determine which actions should take place on a web server. There are a variety of HTTP methods, however a few examples include:

  • GET Retrieves information from the web server that is defined by a specific URL
  • POST Post information to the web server such as a comment on a forum.
  • PUT Create or replace a resource based on the data the client submits to the web server. (e.g creating a new web page or updating an existing one)
  • DELETE Deletes the resource from the web server associated with a specific URL.

HTTP methods can be configured on the web server to determine which objects should be allowed or disallowed to use particular methods. If a method itself is not allowed throughout a site, this will return an HTTP 501 error.

However in the case of 405 Method Not Allowed, this error indicates that the web server is configured in a way that does not allow you to perform that action for a particular URI. For instance, a website's static image files will have the request method set to GET only and will disallow the POST method.

405 error example

To demonstrate a simple 405 Method Not Allowed example, we can use a curl command within the terminal. This example replicates a sample POST request to a resource that only accepts GET requests as can be seen by the image below.

Now if we attempt to pass the HTTP POST method for the same resource via curl with:

curl -X POST

We receive the response:

    <head><title>405 Not Allowed</title></head>
    <body bgcolor="white">
    <center><h1>405 Not Allowed</h1></center>

This demonstrates that the resource will solely allow the GET method thus throwing an error for other methods that make a request for the same URL.

How you might see a 405 Method Not Allowed error

This error is primarily displayed as 405 Method Not Allowed, however there are a couple of other slight variations the web server may display such as:

  • HTTP 405
  • Error 405
  • (405) Method Not Allowed

Although the message may slightly differ, they all mean the same thing - the HTTP method used is currently not allowed for the specific web asset being requested from the web server.

Why did I receive a 405 error?

In the case that a 405 Method Not Allowed error occurs, it may be due to certain scripts you are trying to run. Some ISP's do not allow particular scripts or the necessary POST method to be run on their servers which will therefore return a status code 405. Otherwise, there may be an issue with the web server not being configured properly to accept the appropriate request methods.

KeyCDN uses cookies to make its website easier to use. Learn more about cookies.