Dan Bolofe
Dan Bolofe

Reputation: 1139

Django - cache page on server but NOT on client

I have a few (almost) static pages on my website, I use @cache_page to cache the entire response.

@cache_page(99999)
def my_view(...)

The problem is that this automatically adds the header "max-age=99999" to the response and I do NOT want the client to do any caching.

How can I cache entire HTML responses on the server without allowing client caching?

Upvotes: 1

Views: 225

Answers (1)

vsd
vsd

Reputation: 1473

Use never_cache decorator:

from django.views.decorators.cache import never_cache

@never_cache
@cache_page(99999)
def my_view(request):
    # ...

Upvotes: 1

Related Questions