feat(cache): add 30-day browser cache for uploaded images (middleware + S3 CacheControl)

This commit is contained in:
2026-07-18 08:23:13 +08:00
parent 54d778971d
commit 2dc68ff408
3 changed files with 16 additions and 2 deletions

View File

@@ -103,6 +103,7 @@ class S3Storage:
def put(self, key: str, data: bytes, content_type: str = "image/jpeg") -> str:
self._client.put_object(
Bucket=self.bucket, Key=key, Body=data, ContentType=content_type,
CacheControl="public, max-age=2592000, immutable",
)
return key