gpt4 book ai didi

asp.net - 无法删除 HTTP-Azure 应用服务中请求 header 中的服务器名称

转载 作者:行者123 更新时间:2023-12-02 06:41:45 25 4
gpt4 key购买 nike

我已经做了必要的 web.config(在 D:\home\site\wwwroot 中找到),这还有一个重写规则将所有内容重定向到 https

        <configuration>
<system.web>
<!-- <compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" enableVersionHeader="false" />-->
<httpRuntime enableVersionHeader="false" />
<!--<customErrors mode="RemoteOnly" defaultRedirect="https://concierge.digitaldesk.accenture.com"/>-->
</system.web>
<system.webServer>
<security>
<requestFiltering removeServerHeader="true"/>
</security>


基于https://securityheaders.com/

带重定向的原始 header

enter image description here

没有重定向的原始 header

enter image description here

它突然显示服务器名称,我也需要将其删除。

请帮忙!!

最佳答案

我认为您的问题与 Azure 门户中 Web 应用程序 TLS/SSL 设置部分的“仅 HTTPS”设置有关。如果您将“仅 HTTPS”设置为 ON,则对 HTTP(而非 HTTPS )的第一个请求不会命中您的应用程序代码,并且您的 web.config 不适用。 Microsoft 直接响应 301(+ 服务器 header )。下一个请求没有服务器名称,因为正在应用 web.config 规则。

尝试禁用“仅 HTTPS”并使用 web.config 或应用程序代码中的规则进行重定向。这应该可以解决问题。

为了证明我的分析,将“仅 HTTPS”设置为 ON,在日志中搜索 http 请求:如果您设置了应用程序洞察,则可以像这样查询日志

requests 
| where url startswith "http:"
| order by timestamp desc

如果我的分析正确,您将不会在那里找到任何请求。但如果您禁用“仅 HTTPS”,那么您还将看到对 http 的请求

关于asp.net - 无法删除 HTTP-Azure 应用服务中请求 header 中的服务器名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61091945/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com