djangodocs.org

309 sections across all versions Narrow to Django 6.0 (current) →

CSRF_COOKIE_HTTPONLY

Reference Settings

Default: False Whether to use HttpOnly flag on the CSRF cookie. If this is set to True, client-side JavaScript will not be able to access the CSRF cookie.

dev

CSRF_COOKIE_HTTPONLY

Reference Settings Core Settings

Default: False Whether to use HttpOnly flag on the CSRF cookie. If this is set to True, client-side JavaScript will not be able to access the CSRF cookie.

4.2 5.0 5.1 5.2 6.0

How-to

To take advantage of CSRF protection in your views, follow these steps: The CSRF middleware is activated by default in the MIDDLEWARE setting.

dev

How it works

Reference Cross Site Request Forgery protection

The CSRF protection is based on the following things: A CSRF cookie that is a random secret value, which other sites will not have access to. CsrfViewMiddleware sends this cookie with the response whenever django.middleware.csrf.get_token() is called.

dev

How it works

Reference Cross Site Request Forgery protection

The CSRF protection is based on the following things: A CSRF cookie that is a random secret value, which other sites will not have access to. CsrfViewMiddleware sends this cookie with the response whenever django.middleware.csrf.get_token() is called.

4.2 5.0 5.1 5.2 6.0