# HTTP 501 未实现

**HTTP 501 未实现**（HTTP 501 Not Implemented）是超文本传输协议中的一种服务器错误响应状态码，表示服务器不支持完成请求所需的功能<sup>[1](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501)</sup>。该状态码已在 IANA HTTP 状态码注册表中登记，并在 RFC 9110《HTTP 语义》第 15.6.2 节中定义<sup>[2](https://www.iana.org/assignments/http-status-codes?obref=obinsite)</sup>。

| 关键事实 | 详情 |
|---|---|
| 含义 | 服务器不支持完成请求所需的功能<sup>[1](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501)</sup> |
| 典型触发条件 | 服务器无法识别请求方法，且无法对任何资源支持该方法<sup>[1](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501)</sup> |
| 强制方法 | 所有通用服务器必须支持 GET 和 HEAD，因此不得对这两个方法返回 501<sup>[3](https://www.rfc-editor.org/rfc/rfc2616.html)</sup> |
| 与 405 的区别 | 405 方法不允许适用于服务器认识该方法、但目标资源不允许使用该方法的情形；501 适用于方法无法识别或未实现的情形<sup>[3](https://www.rfc-editor.org/rfc/rfc2616.html)</sup> |
| 缓存 | 除非缓存首部另有指示，501 响应默认可缓存<sup>[1](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501)</sup> |
| 可选首部 | 响应可包含 Retry-After 首部，告知客户端可在指定时间后重试<sup>[1](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501)</sup> |
| 规范 | RFC 9110（HTTP 语义）第 15.6.2 节<sup>[2](https://www.iana.org/assignments/http-status-codes?obref=obinsite)</sup> |

## 服务器何时返回 501

该状态码针对的是一种特定情形：请求方法属于服务器软件无法识别或完全无法处理的方法。1999 年的 HTTP/1.1 规范 RFC 2616 划定了后来各版规范沿用的一条界线：如果方法已知但目标资源不允许，源服务器应返回 405（方法不允许）；如果方法无法识别或源服务器未实现，则应返回 501<sup>[3](https://www.rfc-editor.org/rfc/rfc2616.html)</sup>。2014 年承接该定义的 RFC 7231 陈述了同样的规则，并补充道，所有通用服务器必须支持 GET 和 HEAD，其余方法均为可选<sup>[4](https://www.rfc-editor.org/rfc/rfc7231.html)</sup>。

这一区别在于作用范围。405 响应是端点级别的：服务器认识这个动词，但具体的目标 URI 不支持它，且服务器必须发送 Allow 首部，列出该资源当前支持的方法<sup>[5](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/405)</sup>。501 响应则是关于服务器全局能力的声明：服务器在任何路由上都不支持或无法识别该方法，例如自定义动词，或未配置处理器时的 WebDAV 方法（如 PROPFIND）<sup>[6](https://lens.net/compare/405-vs-501/)</sup>。

由于 GET 和 HEAD 是强制性的，对这两个方法中的任何一个返回 501，表明服务器存在故障或不符合规范，而非有意设限<sup>[1](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501)</sup>。

## 响应属性

除非缓存首部另有指示，501 响应默认可缓存，并且可以携带 Retry-After 首部，告知客户端何时重试可能成功<sup>[1](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501)</sup>。作为 5xx 状态码，它将责任归于服务器端：501 错误不是访问者能够修复的，需要由所访问的 Web 服务器来修复<sup>[7](https://devdoc.net/web/developer.mozilla.org/en-US/docs/Web/HTTP/Status/501.html)</sup>。

## 实际出现场景

**扩展方法。** HTTP 扩展框架（RFC 2774）允许客户端在请求中附加强制扩展，而无法处理由此产生的扩展方法（如 M-GET）的代理，应当以 501 拒绝该请求<sup>[1](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501)</sup>。WebDAV 是另一个常见来源：当诸如 SEARCH 或 PROPFIND 之类的请求方法没有配置 URL 处理器来处理时，服务器便以 501 响应<sup>[1](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501)</sup>。

**服务器实现。** 微软 Internet 信息服务（IIS）按设计在 Internet 客户端使用未知方法时返回 501，因为 IIS 仅支持 RFC 2616（HTTP/1.1）和 RFC 2518（WebDAV）中定义的方法<sup>[8](https://learn.microsoft.com/en-us/troubleshoot/developer/webapps/iis/site-behavior-performance/http-error-501-not-implemented)</sup>。

**Web 上的方法支持情况。** 2014 年，欧道明大学从事 Web 归档研究的研究人员萨伍德·阿拉姆（Sawood Alam）、查尔斯·L·卡特利奇（Charles L. Cartledge）和迈克尔·L·纳尔逊（Michael L. Nelson）开展了一项测量研究，从 [DMOZ](https://www.edgepedia.org/zh/dmoz) 集合中抽样了 40,870 个在线 URI，发现约 55% 的 URI 在其 Allow 首部中声称支持 GET 和 POST，而声称支持 PUT、PATCH 或 DELETE 中一种或多种的不足 2%<sup>[9](https://arxiv.org/abs/1405.2330)</sup>。同一研究观察到，服务器对较少见的方法会返回 501 未实现，反映出公共 Web 服务对方法支持的局限<sup>[10](https://citeseerx.ist.psu.edu/document?doi=3cff715f450584025c5dbfcdd12954ff9be943ff&repid=rep1&type=pdf)</sup>。

## 对客户端和网站访客而言

在网页上看到 501 错误的访问者无法直接修复原因。MDN 的建议是清除该域名的浏览器缓存、禁用正在使用的任何代理，或稍后重试，而根本问题则需要服务器所有者或管理员调查并修复<sup>[1](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501)</sup>。

对 API 设计者而言，实用的规则是：当某个特定 URL 路由禁止使用服务器在其他地方已实现的标准 HTTP 方法时，返回 405 方法不允许；当服务器软件完全缺乏处理该方法的底层能力时，返回 501 未实现<sup>[6](https://lens.net/compare/405-vs-501/)</sup>。对服务器显然在其他地方已实现的方法使用 501，是一种契约错误；在这种情况下，正确的状态码是 405<sup>[11](https://www.api-contract.com/api-design-fundamentals-architecture/http-method-mapping-guidelines/handling-405-vs-501-for-unsupported-methods/)</sup>。

## 历史

该状态码自第一版 HTTP/1.1 规范——1997 年 1 月的 RFC 2068 起，就是 HTTP 的一部分，该规范将 501 未实现列入服务器错误 5xx 状态码之中<sup>[12](https://www.rfc-editor.org/info/rfc2068/)</sup>。它经由 RFC 2616（1999 年 6 月）<sup>[3](https://www.rfc-editor.org/rfc/rfc2616.html)</sup>和 RFC 7231（2014 年 6 月）<sup>[4](https://www.rfc-editor.org/rfc/rfc7231.html)</sup>传承下来，当前定义见 2022 年 6 月发布的 RFC 9110《HTTP 语义》第 15.6.2 节<sup>[2](https://www.iana.org/assignments/http-status-codes?obref=obinsite)</sup>。为 HTTP 扩展框架定义的相关状态码 510 未扩展，此后已在 IANA 注册表中被废弃<sup>[2](https://www.iana.org/assignments/http-status-codes?obref=obinsite)</sup>。

## References

1. [501 Not Implemented – HTTP, MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/501)
2. [Hypertext Transfer Protocol (HTTP) Status Code Registry, IANA](https://www.iana.org/assignments/http-status-codes?obref=obinsite)
3. [RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1, RFC Editor](https://www.rfc-editor.org/rfc/rfc2616.html)
4. [RFC 7231: HTTP/1.1 Semantics and Content, RFC Editor](https://www.rfc-editor.org/rfc/rfc7231.html)
5. [405 Method Not Allowed – HTTP, MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/405)
6. [405 Method Not Allowed vs. 501 Not Implemented, HTTPLens](https://lens.net/compare/405-vs-501/)
7. [501 Not Implemented – HTTP, MDN (archived mirror), DevDocs mirror](https://devdoc.net/web/developer.mozilla.org/en-US/docs/Web/HTTP/Status/501.html)
8. [HTTP error 501 when you use unknown methods – Internet Information Services, Microsoft Learn](https://learn.microsoft.com/en-us/troubleshoot/developer/webapps/iis/site-behavior-performance/http-error-501-not-implemented)
9. [Support for Various HTTP Methods on the Web (Alam, Cartledge, Nelson), arXiv:1405.2330](https://arxiv.org/abs/1405.2330)
10. [Support for Various HTTP Methods on the Web (full text), CiteSeerX](https://citeseerx.ist.psu.edu/document?doi=3cff715f450584025c5dbfcdd12954ff9be943ff&repid=rep1&type=pdf)
11. [Handling 405 vs 501 for Unsupported Methods, API Contract](https://www.api-contract.com/api-design-fundamentals-architecture/http-method-mapping-guidelines/handling-405-vs-501-for-unsupported-methods/)
12. [RFC 2068: Hypertext Transfer Protocol -- HTTP/1.1, RFC Editor](https://www.rfc-editor.org/info/rfc2068/)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 网络与安全 › HTTP与Web通信协议 › HTTP状态码

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/http-501-not-implemented

English original: https://www.edgepedia.org/http-501-not-implemented
