@@ -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'"
@@ -721,7 +724,7 @@ check_invalidation_status() {
721724
722725invalidate_cf_cache ()
723726{
724- if [ " $CFCACHE " = " true" ]; then
727+ # if [ "$CFCACHE" = "true" ]; then
725728 if [ -z $AWS_CLOUD_FRONT_ID ]; then
726729 echo " Based on header applicaiton has invalidated"
727730 echo " Skipped which is based on AWS cloudfront ID.Kindly raise request to configure cloud front ID in deployment configuration"
@@ -730,7 +733,7 @@ invalidate_cf_cache()
730733 INVALIDATE_ID=` aws cloudfront create-invalidation --distribution-id $AWS_CLOUD_FRONT_ID --paths ' /*' | $JQ ' .Invalidation.Id' `
731734 check_invalidation_status " $INVALIDATE_ID "
732735 fi
733- fi
736+ # fi
734737}
735738
736739download_envfile ()
0 commit comments