How to set expiry for play cookie Subscribe Pub

Using playframework 2.1.0, you can set the expiration for the default session cookie doing the following. There's a lot of articles whatnot about this, most of them though don't work. I did the following and it worked! Enjoy!

in application.conf, set the desired lifetime in seconds


Note that trying with 7d or any such number doesn't work.

Then issue a play clean compile to apply this change.

Then enjoy the new 10 day cookie.

To test it, I used Firefox with Firebug and the Firecookie plugin. Yes - even that doesn't work as advertised: to get the cookie tab in firebug, you need to install this new add-on, the Firecookie.

Good luck!

p.s. Update for play 2.3 and up - this is now a duration like 7d not just a number.

Was this useful?    

By: Razie | 2013-04-04 .. 2016-05-10 | Tags: post , scala , play , configuration

See more in: Cool Scala Subscribe

Viewed 2046 times ( | Print ) this page.

You need to log in to post a comment!