Set immutable cache-control header for media downloads

This commit is contained in:
Tulir Asokan 2023-02-12 14:39:50 +02:00
parent ca4efe51d4
commit 14fe6acb3b

View File

@ -183,7 +183,9 @@ def add_file_headers(
# recommend caching as it's sensitive or private - or at least
# select private. don't bother setting Expires as all our
# clients are smart enough to be happy with Cache-Control
request.setHeader(b"Cache-Control", b"public,max-age=86400,s-maxage=86400")
request.setHeader(
b"Cache-Control", b"public,immutable,max-age=31536000,s-maxage=86400"
)
if file_size is not None:
request.setHeader(b"Content-Length", b"%d" % (file_size,))