Windows Server 2008R2/IIS 7.5。我有一个将所有http请求重定向到https的规则,如下所示:
<rule name="HTTPS Redirect">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>正如预期的那样,这一直运行得很好。现在为了符合PCI规范,我们的ASV要求服务器类型/版本不显示在http报头中。所以我添加了这个出站规则:
<outboundRules rewriteBeforeCache="true">
<rule name="Response Server">
<match serverVariable="RESPONSE_SERVER" pattern=".+" />
<action type="Rewrite" />
</rule>
</outboundRules>这对于对服务器的https请求非常有效,Server:头是空的,正如预期的那样:
HTTP/1.1 200 OK =>
Cache-Control => private
Content-Length => 13049
Content-Type => text/html
Server =>
X-Frame-Options => DENY
Strict-Transport-Security => max-age=31536000;
Date => Tue, 12 Jun 2018 18:41:59 GMT
Connection => close但是对于http请求,服务器头部是通过重定向返回的:
HTTP/1.1 301 Moved Permanently =>
Content-Type => text/html; charset=UTF-8
Location => https://www.example.com/
Server => Microsoft-IIS/7.5
Strict-Transport-Security => max-age=31536000;
Date => Tue, 12 Jun 2018 18:44:50 GMT
Connection => close
Content-Length => 151outboundRules似乎未在处理。如何在所有情况下删除Server:标头?
发布于 2018-06-13 07:23:51
我删除了我之前在这里得到的答案。事实证明,添加名为Server:的自定义标头并不能解决问题,而不是。它愚弄了some tools,但不是所有人。即使是我创建的用于转储Ajax调用的标头的简单JavaScript也没有。
我的最终解决方案是使用一个名为StripHeaders的原生代码模块。完整的源代码,外加一个微星安装程序,可以在GitHub上找到。
https://stackoverflow.com/questions/50823957
复制相似问题