在 IIS7 管理器的 "HTTP Response Headers" 模块中添加自定义响应 header 如果无法访问 web.config 文件,可以使用吗?

Adding custom response header in "HTTP Response Headers" module within IIS7 Manager ok to use if cannot access web.config file?

我正在尝试插入自定义响应 header 以符合启用 HSTS 的要求,因为当前布局面临我们网络安全审计的风险。

I am referencing this previous Whosebug thread,因为 "best answers" 建议使用 IIS7 管理器界面设置自定义响应 header,而第二个 "best answer" 将进入 [=13] =] 文件并将代码复制并粘贴到其中。

I tried to follow directions to access using this link, but I did not get far because I do not have EFTAdHoc subfolder under Default Web Site on step 3.

我很好奇如果我这样设置自定义响应header是否还可以:

I am curious if it is still ok if I set the custom response header this way:

此对话正在为所有请求添加 headers。但就您而言,您需要略有不同。您只需要为 HTTPS 请求添加 HSTS。您之前提到的 thread 中的答案是正确的,因为它仅在 HTTPS 请求时才设置 header 。

您可以使用 IIS 管理器执行此操作。

1) 转到 URL 重写 2)点击添加规则->出站规则->空白规则 3)填写这样的字段: