405 Method Not Allowed

405 Method Not Allowed

When you encounter the 405 Method Not Allowed error, it means that the server acknowledges the existence of the requested resource, but the specific HTTP method used in the request is not permitted for that resource.

You can Check Your URLs HTTP Code for FREE

Introduction
In Action
Sample
Conclusion

Introduction

When you encounter the 405 Method Not Allowed error, it means that the server acknowledges the existence of the requested resource, but the specific HTTP method used in the request is not permitted for that resource. For instance, trying to use a DELETE method on a read-only resource will trigger this error.

By default, the response is cacheable, but if the server needs to handle caching differently, it can include the necessary HTTP caching headers in the response.

In Action

When you encounter the 405 Method Not Allowed error, it means that the server recognizes the existence of the requested resource, but the specific type of request you made is not permitted.

The server will provide an Allow header in the response to inform you about the supported operations for that resource, so you can choose the appropriate method for the next request.

Note that search engines like Google will not index a URL that returns a 405 status code, and any previously indexed URLs returning this code will be removed from search results.

Sample

In the example, when the client tries to delete a resource that is read-only, the server responds with the 405 Method Not Allowed status code.

The response from the server indicates that only HTTP methods like GET, HEAD, and OPTIONS are allowed for this particular resource. So, the client should use one of these permitted methods for further operations.

Request

DELETE /policies.pdf HTTP/1.1
Host: www.example.com

Response

HTTP/1.1 405 Method Not Allowed
Allow: GET, HEAD, OPTIONS
Content-Type: text/html
Content-Length: 157

< html>
< head>
< title>Operation Not Permitted< /title>
< /head>
< body>
< p>This resource is read-only and cannot be deleted.< /p>
< /body>
< /html>

Conclusion

The 405 Method Not Allowed status code is returned by the server when the client attempts to use an unsupported HTTP method for a specific resource.

The server informs the client about the allowed methods in the response, and the client should use one of those permitted methods to interact with the resource successfully.

Related articles

999 Request Denied

999 Request Denied The 999 HTTP response status code is...

599 Network Connect Timeout Error

599 Network Connect Timeout Error The 599 HTTP response status...

598 Network read timeout error

598 Network read timeout error The 598 HTTP response status...

561 Unauthorized

561 Unauthorized The 561 HTTP response status code means there...

530 Site Frozen

530 Site Frozen The 530 HTTP response status code is...

999 Request Denied

0
999 Request Denied The 999 HTTP response status code is an unofficial catch-all error code returned...

599 Network Connect Timeout Error

0
599 Network Connect Timeout Error The 599 HTTP response status code indicates a timeout when trying...

598 Network read timeout error

0
598 Network read timeout error The 598 HTTP response status code indicates a timeout occurred during...

561 Unauthorized

0
561 Unauthorized The 561 HTTP response status code means there was an authentication failure. You can Check...

530 Site Frozen

0
530 Site Frozen The 530 HTTP response status code is a specialized server error used by...