404 Not Found는 서버가 요청한 리소스를 찾을 수 없음을 나타내는, 가장 널리 알려진 상태 코드입니다. URL은 서버에 도달했지만 그 경로에 대응하는 리소스가 존재하지 않을 때 반환됩니다.
끊어진 링크, 삭제된 페이지, 오타가 있는 URL이 흔한 원인이며, 서버는 때때로 리소스의 존재 여부를 숨기기 위해 403 대신 의도적으로 404를 돌려주기도 합니다.
GET /articles/this-does-not-exist HTTP/1.1
Host: example.comHTTP/1.1 404 Not Found
Content-Type: text/html; charset=utf-8
<!doctype html><h1>404 Not Found</h1><p>The page you requested could not be found.</p>// after all routes:
app.use((req, res) => {
res.status(404).send('Not found');
});@app.errorhandler(404)
def not_found(e):
return {'error': 'not_found'}, 404