如何通过PowerShell删除非IIS,OS源头? [英] How to remove non-IIS , OS source headers via powershell?
问题描述
在 https://stackoverflow.com/a/18152186/147637 中,有一个很好的示例如何使用powershell删除X-Powered-By标头。这很有效。
In https://stackoverflow.com/a/18152186/147637, there is a nice example how to use powershell to remove the X-Powered-By header. That works great.
我如何在powershell中抑制这些addl标题:
How do I , in powershell, suppress these addl headers:
- 服务器
- X-AspNet-Version
- 和其他X-Powered-By(X-Powered-By:UrlRewriter.NET 2.0) .0)
Server: Microsoft-IIS/8.5
X-Powered-By: UrlRewriter.NET 2.0.0
X-AspNet-Version: 4.0.30319
推荐答案
X-Powered-By:实际上是从IIS根配置继承的。脚本删除了X- Powered-By标题假定您已安装Powershell和Web服务器(IIS)管理Cmdlet并找出正确的咒语。
"X-Powered-By:" is actually inherited from the IIS root configuration.The script to remove the "X-Powered-By" header assumes you have Powershell and the Web Server (IIS) Administration Cmdlets installed and figure out the correct incantations.
Import-Module WebAdministration;
Clear-WebConfiguration "/system.webServer/httpProtocol/customHeaders/add[@name='X-Powered-By']"
如需进一步的帮助,请参阅 https://www.troyhunt.com/shhh-dont-let-your-response-headers/
For Further help, you can refer https://www.troyhunt.com/shhh-dont-let-your-response-headers/
这篇关于如何通过PowerShell删除非IIS,OS源头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!