501 Not Implemented는 서버가 요청을 처리하는 데 필요한 기능 자체를 지원하지 않는다는 뜻입니다. 서버가 인식하지 못하는 요청 메서드이거나, 아직 구현되지 않은 기능을 호출했을 때 반환됩니다.
405 Method Not Allowed와 비슷해 보이지만 차이가 있습니다. 405는 '해당 메서드를 알지만 이 리소스에는 허용하지 않는다'이고, 501은 '해당 기능/메서드를 서버가 아예 구현하지 않았다'는 서버 측 한계입니다.
PATCH /api/resource HTTP/1.1
Host: api.example.com
Content-Type: application/json
{"x":1}HTTP/1.1 501 Not Implemented
Content-Type: text/plain
The server does not support the functionality required to fulfill this request.app.all('/api/experimental', (req, res) => {
res.status(501).send('Not Implemented');
});# Reject methods the server does not implement
if ($request_method !~ ^(GET|POST|HEAD)$) {
return 501;
}