AssetSync and Cloudfront don't agree on what mimetype js files ought to have
Closed this issue · 3 comments
We suddenly realized today that our production javascript files are not being served compressed by CloudFront - when we dug in, we noticed that they were now getting the Content-Type metadata value 'application/ecmascript'. That appears to be intended - AssetSync is pulling in the mime-types
gem, which is using this data to determine appropriate types.
Sadly, Cloudfront does not consider "application/ecmascript" to be a compressible content-type, and just serves those files uncompressed.
Is this something you are already aware of? What's your recommended solution? MimeTypes doesn't give any good interface for overriding known Content-Types, we're currently monkey-patching your MultiMime.fetch
method and intercepting requests about the js
extension.
It seems there are several types matched by the extension name
Let me add an option to allow overriding file extension name to mime type mapping
That sounds ideal - it's exactly what we went looking for first once we understood the problem. I'm also a little concerned about how hard it is for anyone to notice that they're being affected, but I don't have any good answers for that in mind :-\