Reputation: 47101
Today I found a weird thing: it seems that Chrome(46.0) set some restrictions for specific URL such as cloudfront.net
.
It can be reproduced like this:
In the /etc/hosts
, add two lines:
127.0.0.1 cloudfront.net
127.0.0.1 cloudfront.com
Start Apache or Nginx for the local server
Open chrome and input cloudfront.net
in the address bar
Run the following statement in the console:
document.cookie = "test=test; expires=Thu, 01 Jan 2020 00:00:00 GMT;domain=cloudfront.com; path=/"
And then
console.log(document.cookie)
As can be seen the document.cookie
is empty, it is not set at all, which is weird (See the screenshot below)
However, when I repeat the steps above but change the URL from cloudfront.net
into cloudfront.com
, everything works well like a magic.. (See the screenshot below)
Does anyone have any ideas about this? Thanks!
Upvotes: 2
Views: 1518
Reputation: 47101
I asked the question in Google Group (https://groups.google.com/a/chromium.org/forum/#!msg/chromium-dev/Hs1838k68bw/z_h4EHVwAAAJ) . It looks that Chrome indeed set some restrictions for some sites:
https://groups.google.com/a/chromium.org/d/msg/chromium-dev/Hs1838k68bw/z_h4EHVwAAAJ
Upvotes: 3