2

I am doing some aggressive caching and this results in a CSRF error when I use a previously cached old response.

Is there a way to just refresh the csrf token inside the cached response?

Unable to understand the Caching section in https://docs.djangoproject.com/en/1.10/ref/csrf/

Can someone elaborate a bit on this?

I am using a database backend cache and am using cache.get(key) and cache.set(key, value) to store and retrieve the response.

sureshvv
  • 4,234
  • 1
  • 26
  • 32

1 Answers1

1

I was able to use the csrf_protect decorator to refresh the CSRF tokens in the cached response.

sureshvv
  • 4,234
  • 1
  • 26
  • 32