Error in cookie expiration date for Chrome

烈酒焚心 提交于 2019-12-04 16:15:44

问题


I am having problem with the cookie expiry date on Chrome. I set two cookies like this using ColdFusion:

<cfset thekey = generatesecretkey("DESEDE")>
<cfcookie name="cookie1" value="#Hash(userid&thekey,'SHA-256')#" httponly="true" >
<cfcookie name="cookie2" value="#thekey#" httponly="true" >

They have been working for a while. However, after the upgrade to ColdFusion 10 and working with Chrome, weird thing started to happen. It only happened with Chrome browser. Other browsers do not have this issue:

When these two cookies are set they both end up with an expiry date of Wednesday December 31, 1969 at 7:00:11 PM

This puzzled me greatly. I didn't set any expiry date as you can see. So the default is session only. They are supposed to expire at the end of user's session. My question is where is this date come from? Is it from the ColdFusion 10 server or Chrome? I am lost as to why this date is appearing on the cookie's Expires field in Chrome. With this expiry date, the cookies are considered expired already and won't work.


回答1:


For session cookies Chrome Dev Tools just show that strange expiration date which actually doesn't play any role.




回答2:


Chrome uses this date by default, unless you explicitly specify the cookie's lifetime.

Similar question: What does a cookie with 1969 as the expiration date mean?



来源:https://stackoverflow.com/questions/42522736/error-in-cookie-expiration-date-for-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!