From 333d65ee8aae8e7f8bc307949691956a4eb7ed12 Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Thu, 7 Apr 2016 10:39:08 -0500 Subject: [PATCH] website: force JS/CSS mime-types on deploy Should fix occassional issues with application/octet-stream mime type assets breaking JS/CSS on site. --- website/scripts/deploy.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/website/scripts/deploy.sh b/website/scripts/deploy.sh index d630f1f486..38ae64fb3b 100755 --- a/website/scripts/deploy.sh +++ b/website/scripts/deploy.sh @@ -61,6 +61,15 @@ if [ -z "$NO_UPLOAD" ]; then --add-header="Cache-Control: max-age=31536000" \ --add-header="x-amz-meta-surrogate-key: site-$PROJECT" \ sync "$DIR/build/" "s3://hc-sites/$PROJECT/latest/" + + # The s3cmd guessed mime type for text files is often wrong. This is + # problematic for JS/CSS, so force their mime types to be correct. + s3cmd \ + --mime-type="application/javascript" \ + modify "s3://hc-sites/$PROJECT/latest/assets/javascripts/*.js" + s3cmd \ + --mime-type="text/css" \ + modify "s3://hc-sites/$PROJECT/latest/assets/stylesheets/*.css" fi # Perform a soft-purge of the surrogate key.