From 0297a3c0e360dad0fefaa30530ed1fe27b449e42 Mon Sep 17 00:00:00 2001 From: Greg Kempe Date: Fri, 19 Jul 2024 13:40:07 +0200 Subject: [PATCH] lawlibrary files on CDN --- lawlibrary/settings.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lawlibrary/settings.py b/lawlibrary/settings.py index 477569427..2d4c614f5 100644 --- a/lawlibrary/settings.py +++ b/lawlibrary/settings.py @@ -14,3 +14,10 @@ TEMPLATES[0]["OPTIONS"]["context_processors"].append( # noqa "lawlibrary.context_processors.lawlibrary" ) + + +if not DEBUG: # noqa + # Law Library media files are stored on S3 and served via a Cloudflare CDN (via copying to R2). + # We can therefore set long-lived cache headers and serve them from a custom domain. + AWS_S3_OBJECT_PARAMETERS = {"CacheControl": f"max-age={86400*5}"} + AWS_S3_CUSTOM_DOMAIN = "media.lawlibrary.org.za"