gpt4 book ai didi

asp.net - UseHttpsRedirection 和 UseHsts 有什么区别

转载 作者:行者123 更新时间:2023-12-03 10:48:59 24 4
gpt4 key购买 nike

我不太明白 UseHsts 之间的区别和 UseHttpsRedirection在 .net core 中启动文件的配置部分。谁能解释一下?

最佳答案

根据文档,您应该同时使用两者:

We recommend all production ASP.NET Core web apps call:

  • The HTTPS Redirection Middleware (UseHttpsRedirection) to redirect all HTTP requests to HTTPS.
  • UseHsts, HTTP Strict Transport Security Protocol (HSTS).


ASP.NET Core Enforce HTTPS
.UseHttpsRedirection()将发出从 http 重定向到 https 的 HTTP 响应代码。 .UseHsts()将添加 HSTS 响应 header which the client is supposed to obey.

关于asp.net - UseHttpsRedirection 和 UseHsts 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52556364/

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