SameSite 介绍

参考文档

https://web.dev/samesite-cookies-explained/

https://web.dev/samesite-cookie-recipes/

https://web.dev/schemeful-samesite/

chrome89开始协议不同也属于跨站请求

https://www.chromestatus.com/feature/5096179480133632

如何设置?

  1. func main() {
  2. s := g.Server()
  3. s.BindHandler("/", func(r *ghttp.Request) {
  4. r.Cookie.SetHttpCookie(&http.Cookie{
  5. Name: "test",
  6. Value: "1234",
  7. Secure: true,
  8. SameSite: http.SameSiteNoneMode,// 自定义samesite,配合secure一起使用
  9. })
  10. })
  11. s.SetAddr("127.0.0.1:8080")
  12. s.Run()
  13. }