405 Method Not Allowed HTTP Status Code


The HTTP status code 405 indicates a "Method Not Allowed" response. This error occurs when the web server recognizes the request method, but the method is not supported or not allowed for the requested resource. For example, if you try to use the POST method on a resource that only allows the GET method, the server would return a 405 status code.

The 405 response must include an Allow header that contains a list of the resource's supported methods. This helps the client understand which HTTP methods are accepted by the server for the specific resource. The presence of this header is crucial for client-side applications to adapt their requests accordingly.

In summary, the 405 status code is a server-side error that informs the client that the HTTP method used in the request is not allowed for the target resource, guiding the client to try a different method as indicated by the Allow header included in the server's response.


405 Method Not Allowed

Common Causes

Here are the common causes for a 405 status code:

  1. Incorrect Request Method: The most straightforward cause is when the wrong HTTP method is used for a specific resource. For example, if a resource is set up to only accept GET requests, sending a POST request to that resource would result in a 405 error.

  2. Configuration Issues: Misconfigurations in the server can lead to 405 errors. This could be due to incorrect settings in the web server's configuration files (like .htaccess in Apache or web.config in IIS) that specify which HTTP methods are allowed for a resource.

  3. Routing Issues: In some web frameworks or applications, routes are configured to respond to specific HTTP methods. If a route is not properly set up to handle a certain method, it might return a 405 error when that method is used.

  4. Firewall or Security Settings: Security layers or firewalls might be configured to block certain HTTP methods as a precaution against various types of attacks (like CSRF or XSS attacks). If these security measures are too restrictive, they might inadvertently cause 405 errors for legitimate requests.

  5. Web Application Code: Sometimes, the cause might be within the application code itself. If the code explicitly checks for certain HTTP methods and rejects others, it might return a 405 status code when receiving an unsupported method.

  6. CORS (Cross-Origin Resource Sharing) Issues: When making cross-origin HTTP requests, if the server is not configured to accept certain methods from different origins, it might reject the request with a 405 status code.

To resolve a 405 error, you would typically check the request method to ensure it's correct for the resource you're trying to access, review the server and application configuration to ensure the method is supported, and make any necessary adjustments to server settings, application code, or security configurations.

Browser Support

The following table will show you the current browser support for the 405 Method Not Allowed HTTP status code.

Edge Chrome Firefox Opera Safari
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview

Last updated by CSSPortal on: 1st April 2024