Coldfusion Muse
Posted At : July 3, 2008 2:01 PM | Posted By : Mark Kruger

The "Cannot Create Cookie" Log Entry Explained

If you are like the muse you keep your eye on the log files in the /runtime/logs/ directory. There's some good information in there if you care to poke around. You might notice one item that appears in the *.events.log from time to time - usually in a long list of similar errors. It looks something like:

04/04 07:42:39 error Cannot create cookie: path = /
04/04 07:42:40 error Cannot create cookie: expires = Sun, 28-Mar-2038 12:42:01 GMT
This annoying error has been popping up for years and I have never had a satisfactory explanation for it... until now! Genuine ColdFusion Guru Jochem van Dieten (Europe's answer to Ben Forta) figured out that this comes from cookie requests sent from client to server that are using reserved words like "expires" and "path" in the cookie name. Who knew? Check out his latest blog entry for a thorough explanation.

Comments
Good explanation. I hope someone comes up with a solution, but I really don't see a way. I'll bet this error gets logged even before one line of CF code gets executed.

I have logs with thousands of these lines in them, I'd love to find a way to make them go away. As Jochem mentioned in a comment on his post, there is no reason why those cookie names should be reserved in CF. Maybe Adobe will address this in a coming updater.
# Posted By Ryan | 7/3/08 2:13 PM
@ryan,

couldn't you do some kind of ISAPI or Apache filter that would rewrite them? Maybe you wouldn't want that sort of filter because it would cause unexpected results. I think the best solution would be just don't log them.

-mk
# Posted By mark kruger | 7/3/08 2:17 PM
I know you can rewrite the *URL* with mod_rewrite and ISAPI rewrite, but I don't know if you can modify the other headers associated with the request. If you can, that would be a great idea.
# Posted By Ryan | 7/3/08 2:25 PM
There is an Apache module for rewriting headers, but I have not tried it.

I have researched this though and blogged a working solution if you are willing to get your hands a little dirty in Java:
http://www.codersrevolution.com/index.cfm/2008/7/1...
# Posted By Brad Wood | 7/17/08 12:06 AM



Blog provided and hosted by CF Webtools. Blog Sofware by Ray Camden.