【问题标题】:RequestFiltering value for http verbs in applicationhost.config can be overridden in my websites?可以在我的网站中覆盖 applicationhost.config 中 http 动词的 RequestFiltering 值吗?
【发布时间】:2021-07-09 19:29:25
【问题描述】:

如果 http OPTIONS 已在 applicationhost.config 中配置为 [OPTIONS=false],则在 web.conig 中配置 http [OPTIONS=true] 时,我的网站会发生什么情况?

ApplicationHostFile => 添加 http OPTIONS = false 我的网站级别 web.config => 添加 http OPTIONS = true

哪个优先? & 在启动我的网站时会出现任何问题 [服务器错误]?

[例如: 如果在 applicationhost.config 中添加 http 响应标头,我们将收到错误消息说“不允许重复”。所以当两个文件具有相同的标头时,我们会收到 RequestFiltering http 动词的任何错误?]

【问题讨论】:

  • 什么是“我的网站级别”?如果您的意思是您网站中的web.config,我认为那里不能覆盖任何请求过滤设置。
  • 表示我的网站级别 web.config。 @Lex Li 我们也可以在网站级别配置请求过滤。我只想知道如果 applicationHost 文件具有相同的动词条目会发生什么?
  • 您正在使用 IIS 来托管您的服务,因此 Web.config 文件的优先级将高于使用 Web.config 文件。
  • 是的。它正在考虑通过在 system.webServer/security/requestFiltering 部分添加 和 从我的网站 web.config 进行配置,即使已配置Applicationhost.config 中的相同动词。谢谢。

标签: security web-config iis-8 applicationhost


【解决方案1】:

如果在 Applicatiohost.config 文件中配置了 HTTP 动词,例如,

<system.webServer>
   <security>
    <requestFiltering>
      <verbs allowUnlisted="true" applyToWebDAV="true">
         <add verb="OPTIONS" allowed="false" />
      </verbs>
     </requestFiltering>
   </security>
 </system.webServer>

这可以在我们的网站 web.config 部分中通过配置来覆盖,

<system.webServer>
   <security>
    <requestFiltering>
      <verbs>
         <remove verb="OPTIONS" />
         <add verb="OPTIONS" allowed="false" />
      </verbs>
     </requestFiltering>
   </security>
 </system.webServer>

【讨论】:

    猜你喜欢
    • 2020-01-23
    • 1970-01-01
    • 1970-01-01
    • 2017-02-24
    • 1970-01-01
    • 1970-01-01
    • 2021-11-14
    • 2020-12-03
    • 2010-09-16
    相关资源
    最近更新 更多