From f63be946fd01bb766bd35edb643b54d67f859f85 Mon Sep 17 00:00:00 2001 From: Sagid M Date: Wed, 20 Nov 2019 19:38:11 +0100 Subject: [PATCH] Add CacheControl for fixing the bug on CloudFront There are 2 issues related to Cyclic redirect when using CloudFront https://github.com/sagidM/s3-resizer/issues/5 https://github.com/sagidM/s3-resizer/issues/7 This commit adds the Cache-Control header to prevent that --- index.js | 3 ++- package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) mode change 100644 => 100755 package.json diff --git a/index.js b/index.js index c0d52af..14c7dd0 100755 --- a/index.js +++ b/index.js @@ -58,7 +58,8 @@ exports.handler = async (event) => { Body: result, Bucket: BUCKET, ContentType: data.ContentType, - Key: path + Key: path, + CacheControl: 'public, max-age=86400' }).promise(); return { diff --git a/package.json b/package.json old mode 100644 new mode 100755 index df4ac56..fbc8a9d --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "s3-resizer", "version": "3.0.0", "dependencies": { - "sharp": "^0.23.1" + "sharp": "^0.23.3" }, "devDependencies": { "aws-sdk": "^2.36.0"