我不太明白 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/