Skip to content

Commit

Permalink
Added workaround for Chrome cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Jan 28, 2013
1 parent 6ab569b commit 6bd0080
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES
Expand Up @@ -47,6 +47,8 @@ Release date to be decided.
cause caching.
- Flask will no longer invoke the wrong error handlers if a proxy
exception is passed through.
- Added a workaround for chrome's cookies in localhost not working
as intended with domain names.

Version 0.9
-----------
Expand Down
8 changes: 7 additions & 1 deletion flask/sessions.py
Expand Up @@ -192,7 +192,13 @@ def get_cookie_domain(self, app):
return app.config['SESSION_COOKIE_DOMAIN']
if app.config['SERVER_NAME'] is not None:
# chop of the port which is usually not supported by browsers
return '.' + app.config['SERVER_NAME'].rsplit(':', 1)[0]
rv = '.' + app.config['SERVER_NAME'].rsplit(':', 1)[0]
# Google chrome does not like cookies set to .localhost, so
# we just go with no domain then. Flask documents anyways that
# cross domain cookies need a fully qualified domain name
if rv == '.localhost':
rv = None
return rv

def get_cookie_path(self, app):
"""Returns the path for which the cookie should be valid. The
Expand Down

0 comments on commit 6bd0080

Please sign in to comment.