Chrome 的 cookie 过期日期错误 [英] Error in cookie expiration date for Chrome

查看:28
本文介绍了Chrome 的 cookie 过期日期错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Chrome 上的 cookie 到期日期有疑问.我使用 ColdFusion 设置了两个这样的 cookie:

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" >

他们已经工作了一段时间.然而,在升级到 ColdFusion 10 并使用 Chrome 后,奇怪的事情开始发生.它只发生在 Chrome 浏览器上.其他浏览器没有这个问题:

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:

设置这两个 cookie 后,它们的到期日期都结束于1969 年 12 月 31 日星期三晚上 7:00:11

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

这让我非常困惑.如您所见,我没有设置任何到期日期.所以默认是session only.它们应该在用户会话结束时过期.我的问题是这个日期是从哪里来的?是来自 ColdFusion 10 服务器还是 Chrome?我不知道为什么这个日期会出现在 Chrome 中 cookie 的 Expires 字段中.有了这个到期日期,cookie 就被认为已经过期并且无法使用.

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.

推荐答案

对于会话 cookie,Chrome 开发工具只显示奇怪的过期日期,实际上没有任何作用.

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

这篇关于Chrome 的 cookie 过期日期错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆