Skip to content

Commit 263691e

Browse files
committed
chore(web): add cache-control headers
1 parent 79788db commit 263691e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/compass-web/scripts/upload.mts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ const s3Client = new S3({
5454
credentials: getCredentials(),
5555
});
5656

57+
const CACHE_MAX_AGE = 5 * 1000 * 60; // 5mins
58+
5759
for (const file of artifacts) {
5860
const filePath = path.join(DIST_DIR, file);
5961
// NB: important that upload root directory is always `compass/`
@@ -83,6 +85,7 @@ for (const file of artifacts) {
8385
ContentType: contentTypeForExt[path.extname(file)],
8486
ContentEncoding: 'br',
8587
ContentLength: compressedFileContent.byteLength,
88+
CacheControl: `public, max-age=${CACHE_MAX_AGE}, must-revalidate`,
8689
});
8790

8891
console.log('Successfully uploaded %s (ETag: %s)', file, res.ETag);

0 commit comments

Comments
 (0)