django-private-storage icon indicating copy to clipboard operation
django-private-storage copied to clipboard

Disabling client cache should be optionable

Open asfaltboy opened this issue 4 years ago • 2 comments

The commit 713f9188ad5b25c604ac8736609b1ce5fefa224d added a decorator that sets the cache-control and expires headers to explicitly disable caching on the client.

While I can see how this may be useful in some cases, it doesn't work for my use case. I want to be able to allow a client which had an authorized user access an image, to keep accessing it for a short while after, thus I'd like to customize the cache-control's max-age and expires values to something else (perhaps something closer to what the S3 token expiry is set to).

How do you feel about allowing the header values to be customized? Or perhaps allowing users to specify the expiry time delta (in seconds?) or None (to disable cache) ? If you agree with one of these solutions, I would love to submit a pull request.

asfaltboy avatar Apr 17 '20 08:04 asfaltboy

I agree - was trying to figure out what was disabling the cache (thought I mis-configured the server) and traced it back to @add_no_cache_headers. Would be nice to have this configurable.

mfxuus avatar Jul 24 '20 18:07 mfxuus

Totally agree -- could we at least can turn it on/off so the cache is allowed? thanks!

xjlin0 avatar May 26 '21 16:05 xjlin0