因为服务器开启'localhost:9999",使用IE无法登陆,firefox下正常。
遂查看cookie,果然没有写入。
*.com:
"ie enable cookies for localhost"
"ie localhost not working"
一般答案都是重置IE,设置hosts文件:127.0.0.1 localhost,都无法解决问题。
正解:
IEs认为domain name都带‘.’,不能为一级域名,所以hosts文件设置"127.0.0.1 localhost.com",可以解决问题 :)
顺便插一句:很多大型网站为了减轻服务器压力,一般把资源文件的cookie domain单独使用一个域名。
ref:http://*.com/questions/7346919/chrome-localhost-cookie-not-being-set
Cookies are designed for second level and down. First level domains will not work. Instead you should use the address http://127.0.0.1 (as you mentioned) or you could edit your hosts file to map a different URL with a TLD to the address 127.0.0.1 such as:
yoursite.tld 127.0.0.1
Just researched this further; found this answer: Cookies on localhost with explicit domain