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

问题描述

有些情况下,当应用部署到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

 

posted @ 2020-08-26 22:37  路边两盏灯  阅读(225)  评论(0编辑  收藏  举报