0

给定一个 Web 应用程序(在 IIS 中托管的 netcoreapp3.0)——任何具有特定 Accept-Encoding 标头值的请求都不会到达应用程序。http.sys 解析并吐出 400 - BadRequest。

即,Accept-Encoding: application/gzip,gzip

问题似乎是“/”字符。

我们无法控制客户,也不想要求他们遵守/更改客户的要求。他们的请求适用于其他(非 IIS)服务器。

除非我没有正确阅读规范——我相信上述值对标题有效。考虑过在 github 中询问或报告错误 - dotnet/aspnetcore - 但不确定它是否是错误。

感谢您的任何建议。

想避免使用 apache 的 Kestrel | nginx 反向代理。

4

1 回答 1

0

据我所知,accept 和accept-Encoding 不是同一个标头。所以你读错了文章。

正确的 RFC 文章是:https ://www.rfc-editor.org/rfc/rfc7231#section-5.3.4

  The "Accept-Encoding" header field can be used by user agents to
   indicate what response content-codings (Section 3.1.2.1) are
   acceptable in the response.  An "identity" token is used as a synonym
   for "no encoding" in order to communicate when no encoding is
   preferred.

     Accept-Encoding  = #( codings [ weight ] )
     codings          = content-coding / "identity" / "*"

所以它不支持“/”。无法修改设置以允许 IIS 访问错误的标头。

于 2020-01-09T05:42:24.453 回答