After a lazy weekend, suddenly in the middle of your daily brick haul, you realize that the cookie of the local development request test environment has failed again.

Sorry for sending the wrong picture.

I remember turning it off with chrome:// Flags enablement menu.

Set the sameSite by default cookies option to disabled

Sure enough, chrome has removed the experimental switch in its latest version 91.

Fine, it’s up to you. Further research revealed that this policy switch could be forcibly turned off on the command line.

See this POST: A solution for Cross-domain POST requests in Chrome that do not carry Cookies

However, based on the latest version update rules, command line modifications are not supported after version 94.

Alter host; alter host;

SameSite’s validation rules are different from the same origin policy, as you can see in this tutorial.

Therefore, for the test environment a.xxx.com that supports the common HTTP protocol,

We added a configuration to the host file:

127.0.0.1Localhost # for your local development127.0.0.1 test.xxx.com
Copy the code

Vue scaffolding returns an Invalid Host header after the browser restarts.

Host checking in Webpack is not possible, so we need to modify the devServer configuration in VUe-CLI

devServer: {
  disableHostCheck: true,}Copy the code

After restarting the project again, we can see that we have successfully brought our cookies with us.