[Answered ]-With @csrf_exempt still have Set-Cookie: csrftoken

2👍

As @Daniel Roseman indicated, @csrf_exempt will not help you with that.

The middleware responsible for the session cookie is SessionMiddleware. You can read more about it in the Django Docs: How to use sessions. Unfortunately, there is no similar decorator in order to exempt some specific view.

So in order to customize the middleware’s behaviour, you would need to inherit from SessionMiddleware. There is a nice answer on the matter on SO.

👤Wtower

0👍

csrf_exempt controls whether or not CSRF is enforced on POST. It has nothing to do with whether or not the CSRF cookie is set; that is done by the CsrfViewMiddleware for all responses.

Leave a comment