Skip to main content
5xx Server Error

501 Not Implemented

The server does not support the functionality required to fulfill the request, usually because the HTTP method is not recognized.

Meaning & Description

The 501 Not Implemented status code means the server does not recognize the request method or lacks the ability to fulfill it. Unlike a 405 Method Not Allowed, which implies the server knows the method but forbids it on the target resource, a 501 indicates the server doesn’t support the method anywhere at all. It is the appropriate response when a server is missing a required capability entirely.

Common Causes

  • Client sending obscure or custom HTTP methods (e.g., UPDATE, COPY) to a standard web server.
  • Server is out of date and does not support newer methods (like PATCH).
  • API gateway stripping or rejecting specific methods before they reach the backend.
  • Deliberately returning 501 as a placeholder in scaffolding or skeleton API code.

How to fix a 501 error

  1. Inspect the HTTP method being sent by the client. Ensure it is a standard method like GET, POST, PUT, DELETE, or PATCH.
  2. If the method is standard, verify that the web server (Nginx, Apache) or API Gateway allows that method globally.
  3. Check if the server code has a global fallback that incorrectly returns 501 instead of a 404 or 405.

Browser & SEO Behaviour

Browser Behavior

Displays a standard error page. Browsers rarely encounter this since they only send GET, POST, PUT, DELETE, OPTIONS, HEAD, and PATCH by default.

SEO Impact

No direct SEO impact, as search engine crawlers only issue GET and HEAD requests, which every web server supports. If a crawler encounters a 501 on a GET request, it indicates a severe server misconfiguration and will hurt indexing.

CDN Behavior

By default, CDNs pass this error to the client and do not cache it. Some CDNs will outright reject unknown methods with a 501 before hitting the origin server.

Code Examples

HTTP
HTTP/1.1 501 Not Implemented
Content-Type: application/json

{
  "error": "Not Implemented",
  "message": "The TRACE method is not supported by this server."
}
Node.js (Express)
app.all("*", (req, res, next) => {
  const supportedMethods = ["GET", "POST", "PUT", "DELETE"];
  if (!supportedMethods.includes(req.method)) {
    return res.status(501).json({
      error: "Not Implemented",
      message: `Method ${req.method} is not supported.`
    });
  }
  next();
});
Python (FastAPI)
from fastapi import FastAPI, Request, HTTPException

app = FastAPI()

@app.middleware("http")
async def check_method(request: Request, call_next):
    if request.method not in ["GET", "POST", "PUT", "DELETE"]:
        raise HTTPException(status_code=501, detail="Method not implemented.")
    return await call_next(request)
Go (net/http)
package main

import "net/http"

func handler(w http.ResponseWriter, r *http.Request) {
	if r.Method == "FOO" {
		http.Error(w, "Method FOO Not Implemented", http.StatusNotImplemented)
		return
	}
	w.WriteHeader(http.StatusOK)
}

func main() {
	http.HandleFunc("/", handler)
	http.ListenAndServe(":8080", nil)
}
C# (ASP.NET Core)
public class NotImplementedMiddleware
{
    private readonly RequestDelegate _next;
    public NotImplementedMiddleware(RequestDelegate next) => _next = next;

    public async Task Invoke(HttpContext context)
    {
        var method = context.Request.Method;
        if (method == "TRACE" || method == "TRACK")
        {
            context.Response.StatusCode = 501;
            await context.Response.WriteAsync("Method not implemented.");
            return;
        }
        await _next(context);
    }
}
curl
# Sending a custom unrecognized HTTP method
curl -i -X WEIRD_METHOD https://api.example.com/

Raw HTTP Response Example

HTTP Response
HTTP/1.1 501 Not Implemented
Content-Type: application/json
Content-Length: 70

{
  "error": "Not Implemented",
  "message": "Method not recognized"
}

Real-world Examples

Nginx / Apache: Returns 501 by default if a client sends a completely arbitrary HTTP method string that the server engine does not understand.
AWS CloudFront: Can return a 501 Not Implemented if the client issues an HTTP method that the distribution is not configured to allow.

Frequently Asked Questions

What is the difference between 501 Not Implemented and 405 Method Not Allowed?

405 means the server understands the method, but the specific URL does not allow it (e.g., you can’t POST to a read-only endpoint). 501 means the server does not understand or support the method at all, on any URL.

Should I return 501 for features under development?

It is sometimes used as a placeholder, but returning a 503 Service Unavailable or simply a custom JSON error is generally clearer for clients interacting with unfinished APIs.

Can a client trigger a 501 error by accident?

It is rare, but possible if a client uses a tool like cURL or Postman and typographically errors the HTTP method (e.g., "PST" instead of "POST").

How do I resolve a 501 error in my web application?

Ensure the client is sending a standard HTTP method. If it is standard (like PATCH), check that your reverse proxy or web server configuration isn’t stripping or blocking it.

Did You Know?

The HTTP/1.1 specification requires all servers to implement at least the GET and HEAD methods. Thus, a server should technically never return a 501 for GET or HEAD requests.

Historically, web servers would return 501 for the TRACE method as a quick fix to prevent Cross-Site Tracing (XST) attacks.

Developer Tips

  • Do not use 501 to signify "this user action is not supported" or "this API endpoint isn’t ready." It is strictly meant for unsupported HTTP methods or fundamental protocol features.
  • If you are building an API gateway, returning 501 for garbage HTTP method strings is a valid way to reject malformed requests early in the pipeline.

Interview Questions

These are questions you might face in a backend or API design interview that touch on HTTP 501.

When is it appropriate to return a 501 Not Implemented instead of a 405 Method Not Allowed?

Use 501 when the server genuinely does not recognize the HTTP method being used anywhere on the server. Use 405 when the server recognizes the method, but it is explicitly forbidden on the target resource.

Are there any HTTP methods that should never result in a 501?

Yes, GET and HEAD. The HTTP spec mandates that all compliant servers must support at least these two methods.

Common Interview Mistakes

  • Confusing 501 with 404 (Not Found). A 404 is about the resource being missing; a 501 is about the server lacking the capability to process the method.
  • Saying that 501 should be used when a specific query parameter or API feature isn’t implemented yet. That should be a 400 Bad Request or a business-logic error, not a 501.