Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in cookie expiration date for Chrome

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.

like image 966
Jack Avatar asked Mar 01 '17 03:03

Jack


People also ask

How do I change cookie expiry date?

This can be done easily by adding expires=expirationDate in UTC separated by semicolon from the name=value, as seen in the following example: document. cookie = "username=Max Brown; expires=Wed, 05 Aug 2020 23:00:00 UTC"; document.

Does Chrome send expired cookies?

If a cookie has expired, the browser does not send that particular cookie to the server with the page request, and deletes it.

How do I extend a cookie expiry date?

Extend the life of a cookie beyond the current browser session by setting an expiration date and saving the expiry date within the cookie. This can be done by setting the 'expires' attribute to a date and time.


1 Answers

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

like image 181
Konstantin Smolyanin Avatar answered Oct 09 '22 01:10

Konstantin Smolyanin