We updated yesterday our code to the last version of Meteor 1.7 and when we deploy to Galaxy an error appears in the browser (Chrome and Firefox tested).
Refused to execute script from "https://xxxx.cloudfront.net/371890059e93ce15eb387a53a7f0bf59486de356.js?meteor_js_resource=true&_g_app_v_=434" because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Maybe we need to change MIME Type but it’s the js code bundled by Meteor and with the version 1.6.1 it is working correctly. If we stop Cloudfront the web runs normally.
Any idea? How can we change MIME Type for Meteor js bundle, to sometihing like:
That means Cloudfront has cached the file on the edge before it has returned its real content. Either run an invalidation on the file or enable query string forwarding + caching.
I was seeing a similar error with Galaxy + CloudFlare (w/o CloudFront). It stemmed from us invalidating the CF cache, thus removing JS & CSS assets with long URLs with query strings unique to the particular build; meanwhile if the HTML is cached anywhere else in the chain, including in a browser somewhere, it would refer to the old, invalidated asset that would then return 'text/html' via Meteor returning a 404 page.
If you’ve verified that the URL in question is in fact returning valid JS or CSS with the wrong MIME type, it’s probably a CF configuration issue. Otherwise, you might need to change your invalidation settings to have longer TTLs for JS & CSS than for HTML.