在 Start.cs 中添加 UseHsts() 有什么意义
What's the point of adding UseHsts() in Start.cs
根据the docs,在配置中添加UseHsts()激活STS相关的中间件header。
我一直不太明白其中的意义。这是否意味着仅向应用程序执行的每个请求添加一个 header?如果我不使用那个 header 会出什么问题?
此外,我注意到当我尝试查找 Core 2.2(上面的 link)时,我被重定向到 Core 2.1,并带有 UseHsts() 在以前的版本中不存在。这是否意味着它已经过时或正在使用隐藏魔法的默认值?
HTTP Strict Transport Security (HSTS) allows a site to request that it always be contacted over HTTPS. HSTS is supported in Google Chrome, Firefox, Safari, Opera, Edge and IE
引用https://www.chromium.org/hsts
HTTP Strict Transport Security (HSTS) is a web security policy mechanism that helps to protect websites against protocol downgrade attacks and cookie hijacking. It allows web servers to declare that web browsers (or other complying user agents) should interact with it using only secure HTTPS connections,1 and never via the insecure HTTP protocol. HSTS is an IETF standards track protocol and is specified in RFC 6797
如果您使用的是 TLS,则应启用此标志。注意:请确保您没有在本地主机上启用它(如果您没有在本地主机上使用 TLS)。您将无法加载该网站。您需要使浏览器上的缓存失效。
根据the docs,在配置中添加UseHsts()激活STS相关的中间件header。
我一直不太明白其中的意义。这是否意味着仅向应用程序执行的每个请求添加一个 header?如果我不使用那个 header 会出什么问题?
此外,我注意到当我尝试查找 Core 2.2(上面的 link)时,我被重定向到 Core 2.1,并带有 UseHsts() 在以前的版本中不存在。这是否意味着它已经过时或正在使用隐藏魔法的默认值?
HTTP Strict Transport Security (HSTS) allows a site to request that it always be contacted over HTTPS. HSTS is supported in Google Chrome, Firefox, Safari, Opera, Edge and IE
引用https://www.chromium.org/hsts
HTTP Strict Transport Security (HSTS) is a web security policy mechanism that helps to protect websites against protocol downgrade attacks and cookie hijacking. It allows web servers to declare that web browsers (or other complying user agents) should interact with it using only secure HTTPS connections,1 and never via the insecure HTTP protocol. HSTS is an IETF standards track protocol and is specified in RFC 6797
如果您使用的是 TLS,则应启用此标志。注意:请确保您没有在本地主机上启用它(如果您没有在本地主机上使用 TLS)。您将无法加载该网站。您需要使浏览器上的缓存失效。