Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Why does curl receive an expired cookie?

In a response to some url the server is sending a 302 Found response and a cookie. In Firefox this cookie gets set seamlessly. Firebug says:

    Set-Cookie  somekookie=91b115e3d4a5889ed93e70a7ddb24957a1eb0e27cbcd96a3342a8064; expires=Sun, 24-Oct-2010 23:28:55 GMT; path=/; domain=.somedomain.ru

However when curl requests the same url, the cookie is expired, curl's output:

    * Added cookie somecookie="deleted" for domain somedomain.com, path /, expire 1224891945
    < Set-Cookie: somecookie=deleted; expires=Fri, 24-Oct-2008 23:45:45 GMT; path=/; domain=.somedomain.com

Why does the date appear to be so old and how to resolve this issue?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Have you tried:

curl -L -b null somedomain.com

-b turns on cookies, -L follows a location (302). 'null' is any empty/nonexistent file.

or perhaps storing the cookies:

curl -b cookies -c cookies somedomain.com

-c writes to a netscape-style cookies file.

Without any more information that's the best I can do. HTH.

share|improve this answer

Well, when curl does the request there's no Cookie set (unless you specify one), so the server is probably just saying: this is a new session, I'm gonna delete any cookie you might have for any of the sites on this domain just in case.

On the firefox one, is there a cookie sent with the request?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.