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"