【应用服务 App Service】如何移除App Service Response Header中包含的服务器敏感信息

2023-06-20,,

问题描述

有些情况下,当应用部署到App Service上后,在有些Response Header中,可以看见关于服务器的一些信息,这样会导致隐藏的安全问题,所以可以在web.config中移除某些关键的Header信息。如X-Powered-By。

解决方案

在web.config中的httpProtocol中使用remove name来移除需要的header。

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>

另一种保护App Service的机制可以添加Applicaiton Gateway。 如要使用App Gateway可以参考文档:https://docs.azure.cn/zh-cn/application-gateway/configure-web-app-portal

应用服务 App Service】如何移除App Service Response Header中包含的服务器敏感信息的相关教程结束。

《【应用服务 App Service】如何移除App Service Response Header中包含的服务器敏感信息.doc》

下载本文的Word格式文档,以方便收藏与打印。