Skip to content

Commit e30711c

Browse files
Prevent caching when ENABLE_CACHE = false. Enable Caching when ENABLE_CACHE = true.
1 parent 509b209 commit e30711c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

master_deploy.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -649,10 +649,13 @@ deploy_s3bucket() {
649649
cat /etc/mime.types | grep -i map
650650
cat /etc/mime.types | grep -i ttf
651651
if [ "$CFCACHE" = "true" ]; then
652-
S3_CACHE_OPTIONS="--cache-control private,no-store,no-cache,must-revalidate,max-age=0"
653-
echo "*** Deploying with Cloudfront Cache disabled ***"
652+
# caching is enabled, so set the cache control's max age
653+
S3_CACHE_OPTIONS="--cache-control max-age=0,s-maxage=86400"
654+
echo "*** Deploying with Cloudfront Cache enabled ***"
654655
else
655-
S3_CACHE_OPTIONS="--cache-control max-age=0,s-maxage=86400"
656+
# caching is disabled, so set the cache control to never cache
657+
S3_CACHE_OPTIONS="--cache-control private,no-store,no-cache,must-revalidate,max-age=0"
658+
echo "*** Deploying with Cloudfront Cache disabled ***"
656659
fi
657660

658661
S3_OPTIONS="--exclude '*.txt' --exclude '*.js' --exclude '*.css'"

0 commit comments

Comments
 (0)