【问题标题】:Why does IIS return code 404.13 instead of code 413 when a request is too large?当请求太大时,为什么 IIS 返回代码 404.13 而不是代码 413?
【发布时间】:2013-07-30 11:14:12
【问题描述】:

IIS 有一个可配置的阈值,用于过滤掉“太大”的请求,因此可能会对服务器进行 DoS。 Such requests yield code 404.13。然而,HTTP 的代码 413 Request Entity Too Large 看起来正好适合这种情况。

为什么返回的是代码 404 而不是代码 413?

【问题讨论】:

    标签: asp.net http iis http-status-code-404 http-status-codes


    【解决方案1】:

    我不能说为什么 IIS 决定避免使用“请求实体太大”的官方代码并使用他们自己的版本。 IIS 7 (where 404.13 was introduced, also see here for more status codes) 肯定早于 RFC 2068 413 的定义。有趣的是,IIS 5 and 6 used the official 413 code。如果有的话,将 413 子分类到 403(禁止)下可能更有意义。

    This IIS 7 Q&A 建议您可以编写自己的 HttpModule 将 404.13 响应转换为 413 响应。

    旁注:根据RFC 7231,413 现在称为“有效负载太大”

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-18
      • 2015-05-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-04
      相关资源
      最近更新 更多