Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google App Engine Set-Cookie fails to use my expiration date

I am trying to set a cookie in my Google App Engine page:

self.response.headers.add_header('Set-Cookie','CookieName=1234; expires:Sun, 31-May-2009 23:59:59 GMT; path=/;')

The expiration date is not showing up in the browser. So it deletes itself at the end of the session.

Here is the output from curl -D:

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Cache-Control: no-cache
Set-Cookie: CookieName=1234; expires:Fri, 01 Jan 2010 11:48:41 GMT
Date: Fri, 08 May 2009 11:57:25 GMT
Server: Google Frontend
Expires: Fri, 08 May 2009 11:57:25 GMT
Transfer-Encoding: chunked

What am I missing?

like image 744
bentford Avatar asked May 08 '09 10:05

bentford


2 Answers

The problem is you're using "expires:" with a colon. Needs to be "expires=" with an equals.

like image 108
Bert Lamb Avatar answered Oct 21 '22 05:10

Bert Lamb


With a "curl -D somefile" I can check that your cookie comes to the client exactly as specified. Can you check that, and confirm that the issue is with your browser and its settings rather than with the server side?

like image 2
Alex Martelli Avatar answered Oct 21 '22 03:10

Alex Martelli