ColdFusion Muse

The "Cannot Create Cookie" Log Entry Explained

Mark Kruger July 3, 2008 4:01 PM Coldfusion Troubleshooting Comments (4)

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.

  • Share:

4 Comments

  • Ryan's Gravatar
    Posted By
    Ryan | 7/3/08 2:13 PM
    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.
  • mark kruger's Gravatar
    Posted By
    mark kruger | 7/3/08 2:17 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
  • Ryan's Gravatar
    Posted By
    Ryan | 7/3/08 2:25 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.
  • Brad Wood's Gravatar
    Posted By
    Brad Wood | 7/17/08 12:06 AM
    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...