summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorRoger Hu <roger.hu@gmail.com>2014-03-04 00:52:28 +0000
committerTim Graham <timograham@gmail.com>2014-03-06 08:28:43 -0500
commit9b729ddd8f2040722971ccfb3b12f7d8162633d1 (patch)
treed24dbedaa0a561401c9585643c401297b17fcafd /docs/ref
parent06efeae598c6dafbe56d2ea323a0dccdd5bf2b8e (diff)
Fixed #22185 -- Added settings.CSRF_COOKIE_AGE
Thanks Paul McMillan for the review.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/contrib/csrf.txt1
-rw-r--r--docs/ref/settings.txt22
2 files changed, 23 insertions, 0 deletions
diff --git a/docs/ref/contrib/csrf.txt b/docs/ref/contrib/csrf.txt
index 5c73ba3242..4c37f7448c 100644
--- a/docs/ref/contrib/csrf.txt
+++ b/docs/ref/contrib/csrf.txt
@@ -491,6 +491,7 @@ Settings
A number of settings can be used to control Django's CSRF behavior:
+* :setting:`CSRF_COOKIE_AGE`
* :setting:`CSRF_COOKIE_DOMAIN`
* :setting:`CSRF_COOKIE_HTTPONLY`
* :setting:`CSRF_COOKIE_NAME`
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
index f01ce3c7fd..9d133b73eb 100644
--- a/docs/ref/settings.txt
+++ b/docs/ref/settings.txt
@@ -324,6 +324,28 @@ See :doc:`/topics/cache`.
.. _settings-csrf:
+.. setting:: CSRF_COOKIE_AGE
+
+CSRF_COOKIE_AGE
+---------------
+
+.. versionadded:: 1.7
+
+Default: ``31449600`` (1 year, in seconds)
+
+The age of CSRF cookies, in seconds.
+
+The reason for setting a long-lived expiration time is to avoid problems in
+the case of a user closing a browser or bookmarking a page and then loading
+that page from a browser cache. Without persistent cookies, the form submission
+would fail in this case.
+
+Some browsers (specifically Internet Explorer) can disallow the use of
+persistent cookies or can have the indexes to the cookie jar corrupted on disk,
+thereby causing CSRF protection checks to fail (and sometimes intermittently).
+Change this setting to ``None`` to use session-based CSRF cookies, which
+keep the cookies in-memory instead of on persistent storage.
+
.. setting:: CSRF_COOKIE_DOMAIN
CSRF_COOKIE_DOMAIN