same origin 与 same site

  • Ajax 请求会受到浏览器同源策略的制约
  • Cookie 的 SameSite 属性表示该 Cookie 是否能被跨站发送

 

same origin 同源:

源(origin)= 协议(scheme)+ 主机名(hostname)+ 端口号(port)

 

same site 同站:

站(site)= eTLD+1  子域名不影响

 

https://www.example.com.cn

  • eTLDcom.cn
  • eTLD+1example.com.cn

eTLD 由 Mozilla 维护在 Public Suffix List (https://publicsuffix.org/list/public_suffix_list.dat)中,

而site 定义是 eTLD+1

 

 

资料:https://web.dev/i18n/en/same-site-same-origin/

=============================================

 

cookie的samesite属性:

防止CSRF攻击

 

strict: 只有在same-site情况下,才能share cookie

lax:在same-site和cross-site使用get的情况下(navigating to the origin site i.e. when following a link)

none: 任意其他页面都可以

posted @   hh9515  阅读(178)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
点击右上角即可分享
微信分享提示