简体   繁体   English

HTTP请求标头属性路径,域与SameSite

[英]HTTP request header attributes path, domain vs SameSite

If in http response header the "set-cookie" properties "path" and "domain" are set for a site say a.com as path=/, domain=a.com 如果在http响应标头中为站点设置了“ set-cookie”属性“ path”和“ domain”,则说a.com为path = /,domain = a.com

The role of path and domain states- path: url path that must exist in request resource domain: restrict host to which cookies will be sent 路径和域状态的作用-路径:请求资源域中必须存在的url路径:限制将cookie发送到的主机

not what is the role of setting "SameSite" property? 设置“ SameSite”属性的作用不是什么? as it's use case states cookie not to be sent along with cross-site requests. 因为用例说明Cookie不会与跨站点请求一起发送。 as the cookie scope is already restraint to same domain by path and domain attributes. 因为Cookie范围已经通过路径和域属性限制在同一域中。

will SameSite: Lax ovewrites the restriction imposed by path/domain 将SameSite:宽松覆盖路径/域施加的限制

What is the role of setting "SameSite" property? 设置“ SameSite”属性的作用是什么?

There are 2 concept here: the requested resource and where that request is originated. 这里有2个概念:请求的资源和请求的发起地。 For example, you are visiting a.com, and sends an HTTP request to b.com (through Ajax or image loading or hyperlink etc.) In this scenario, the requested resource is data in b.com, while the request is originated from a.com 例如,您正在访问a.com,并向b.com发送HTTP请求(通过Ajax或图像加载或超链接等)。在这种情况下,请求的资源是b.com中的数据,而该请求源自a.com

domain and path is used to restrict which requested resource the cookie can be applied, while SameSite is used to restrict where that request should be originated. domainpath用于限制可应用cookie的请求资源,而SameSite用于限制应在何处发起该请求。

For example, if domain is c.com , it won't be applied in request sent to b.com, no matter whether that request is sent from b.com website or not. 例如,如果domainc.com ,则无论该请求是否从b.com网站发送,它都不会应用于发送到b.com的请求中。 Meanwhile, if SameSite is Strict , as long as you are not in b.com website, the HTTP request to b.com won't bring that cookie, even if that "SameSite-Strict" cookie's domain is b.com and path is / . 同时,如果SameSiteStrict ,只要您不在b.com网站中,即使对“ SameSite-Strict” cookie的domainb.compath/

Will SameSite: Lax ovewrites the restriction imposed by path/domain? SameSite:Lax是否会覆盖路径/域所施加的限制?

No. SameSite and domain/path are 2 different thing. SameSitedomain/path是2个不同的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM