最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - SameSite Cookie Attribute Warning Isn't getting fixed - Stack Overflow

matteradmin8PV0评论

I am using react.js, and I'm trying to integrate lucky orange into my web app. I added the code snippet in the head tag of the index.html file, but I get a warning saying:

A cookie associated with a cross-site resource at / 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.

I tried setting the cookie in the head of the index.html document like this:

document.cookie = 'same-site-cookie=foo; SameSite=Lax';
document.cookie = 'cross-site-cookie=bar; SameSite=None; Secure';

But I'm still getting that error. What am I doing wrong and how can I fix it?

I am using react.js, and I'm trying to integrate lucky orange into my web app. I added the code snippet in the head tag of the index.html file, but I get a warning saying:

A cookie associated with a cross-site resource at http://luckyorange/ 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.

I tried setting the cookie in the head of the index.html document like this:

document.cookie = 'same-site-cookie=foo; SameSite=Lax';
document.cookie = 'cross-site-cookie=bar; SameSite=None; Secure';

But I'm still getting that error. What am I doing wrong and how can I fix it?

Share Improve this question asked Nov 4, 2019 at 3:28 JessicaJessica 9,84016 gold badges73 silver badges155 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 2

Without the actual code you're using, I'm only guessing that the situation here… however, a couple things:

The warning in the console is for http://luckyorange which is not a domain that you manage. Instead, the Lucky Orange team is responsible for ensuring their cookies are set appropriately. Changes you make in your code will only affect cookies set for your domain.

You should check in with Lucky Orange via a support ticket or similar to ensure they are aware of these uping changes and have a plan in place.

At the moment, these warnings are purely informational - they will not affect your site's functionality. This will be the default behaviour as of Chrome 80, stable around Feb 2020.

You will need to ensure your inclusion of any Lucky Orange resources is via HTTPS though, as this is required by the SameSite=None; Secure setting.

There's more context and guidance on https://web.dev/samesite-cookie-recipes.

Post a comment

comment list (0)

  1. No comments so far