summaryrefslogtreecommitdiff
path: root/docs/ref/settings.txt
diff options
context:
space:
mode:
authorJoshua Kehn <josh@kehn.us>2015-08-31 22:32:03 -0400
committerTim Graham <timograham@gmail.com>2015-09-05 09:19:57 -0400
commitab26b65b2f178597be845e203eb698e193e3502e (patch)
tree0373fa71f7f14e4bd4b24efe36554741144209ba /docs/ref/settings.txt
parent48c420d99209b147b58d7b873d1b54f76249c8dc (diff)
Fixed #25334 -- Provided a way to allow cross-origin unsafe requests over HTTPS.
Added the CSRF_TRUSTED_ORIGINS setting which contains a list of other domains that are included during the CSRF Referer header verification for secure (HTTPS) requests.
Diffstat (limited to 'docs/ref/settings.txt')
-rw-r--r--docs/ref/settings.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
index 217f54281d..ed5ac98947 100644
--- a/docs/ref/settings.txt
+++ b/docs/ref/settings.txt
@@ -428,6 +428,23 @@ any hyphens with underscores, and adding an ``'HTTP_'`` prefix to the name.
For example, if your client sends a ``'X-XSRF-TOKEN'`` header, the setting
should be ``'HTTP_X_XSRF_TOKEN'``.
+.. setting:: CSRF_TRUSTED_ORIGINS
+
+CSRF_TRUSTED_ORIGINS
+--------------------
+
+.. versionadded:: 1.9
+
+Default: ``[]`` (Empty list)
+
+A list of hosts which are trusted origins for unsafe requests (e.g. ``POST``).
+For a :meth:`secure <django.http.HttpRequest.is_secure>` unsafe
+request, Django's CSRF protection requires that the request have a ``Referer``
+header that matches the origin present in the ``Host`` header. This prevents,
+for example, a ``POST`` request from ``subdomain.example.com`` from succeeding
+against ``api.example.com``. If you need cross-origin unsafe requests over
+HTTPS, continuing the example, add ``"subdomain.example.com"`` to this list.
+
.. setting:: DATABASES
DATABASES
@@ -3374,6 +3391,7 @@ Security
* :setting:`CSRF_COOKIE_SECURE`
* :setting:`CSRF_FAILURE_VIEW`
* :setting:`CSRF_HEADER_NAME`
+ * :setting:`CSRF_TRUSTED_ORIGINS`
* :setting:`SECRET_KEY`
* :setting:`X_FRAME_OPTIONS`