Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default expire time for a cookie in Rails

What is the default expire time of a cookie in Rails (3.1.3)?

I have found documentation on how to set, how to retrieve, but I fail to see the default expire time.

like image 319
Hommer Smith Avatar asked May 18 '12 00:05

Hommer Smith


People also ask

What is the default expiry time of cookie?

The default time for a Cookie to expire is 30 minutes. The default Expires value for a cookie is not a static time, but it creates a Session cookie. This will stay active until the user closes their browser/clears their cookies. You can override this as required.

Do cookies automatically expire?

Cookies can expire. A cookie with no expiration date specified will expire when the browser is closed. These are often called session cookies because they are removed after the browser session ends (when the browser is closed). Cookies with an expiration date in the past will be removed from the browser.

How do I set cookies to expire time?

You can extend the life of a cookie beyond the current browser session by setting an expiration date and saving the expiry date within the cookie. This can be done by setting the 'expires' attribute to a date and time.

How do cookies expire at end of session?

To set a cookie so it expires at the end of the browsing session, simply OMIT the expiration parameter altogether. Save this answer.


1 Answers

By default, cookies expire at the end of the session (meaning when the user closes their browser).

like image 55
devth Avatar answered Oct 15 '22 18:10

devth