【问题标题】:A cookie associated with a cross-site resource at http://local ip/ was set without the `SameSite` attribute与 http://local ip/ 上的跨站点资源关联的 cookie 被设置为没有 `SameSite` 属性
【发布时间】:2019-11-29 18:50:21
【问题描述】:

尝试在 Cordova 应用程序中调用 localhost URL 我得到以下错误

A cookie associated with a cross-site resource at http://local_ip/ was set without the `SameSite` 
attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are 
set with `SameSite=None` and `Secure`. You can review cookies in developer tools under 
Application>Storage>Cookies and see more details at 
https://www.chromestatus.com/feature/5088147346030592 and 
https://www.chromestatus.com/feature/5633521622188032.

还有这个错误

 Resource interpreted as Document but transferred with MIME type application/vnd.ms-excel: 
"http://local_ip:8083/api/getMailReport? reportType=MU&surId=SUR00002&selectedFromDate=05%2F11%2F2019&selectedToDate=11%2F11%2F2019&lang=E&gener 
ateReport=Generate+Report".

如何解决这个问题

【问题讨论】:

    标签: google-chrome cordova samesite


    【解决方案1】:

    Chrome 将在 Chrome 80 中更改其行为以应用两条新规则:

    1. 默认情况下,没有SameSite 属性的 Cookie 将被视为SameSite=Lax,即它们将仅是第一方或同一站点
    2. 供第三方或跨站点使用的 Cookie 必须标记为 SameSite=None; Secure

    控制台警告只是为了通知您,您需要根据网站需要的行为将相关属性添加到 cookie。

    您可以查看https://web.dev/samesite-cookies-explainedhttps://web.dev/samesite-cookie-recipes 了解更多信息。

    【讨论】:

      猜你喜欢
      • 2020-03-08
      • 2020-05-08
      • 1970-01-01
      • 2023-04-06
      • 1970-01-01
      • 2020-02-05
      • 2020-11-16
      • 2020-02-25
      • 2020-02-21
      相关资源
      最近更新 更多