documentcloud / jammit

Industrial Strength Asset Packaging for Rails
http://documentcloud.github.com/jammit/
MIT License
1.16k stars 197 forks source link

jammit content negotiation with apache #128

Closed tashian closed 13 years ago

tashian commented 13 years ago

I just wanted to point out a little interoperability issue with Apache, jammit, and gzipped assets.

With MultiViews turned on, I believe Apache will not serve any variants unless the requested file itself is not found. So if there is a common.css, for example, Apache will always serve it. I've found that only if I rename common.css to common.css.css, will Apache present the gzipped variant properly when common.css is requested.

Another option is to leave common.css and common.css.gz alone, but change the stylesheet link tag to refer to simply "/assets/common". This is more fragile than the first option, though, because when /assets/common is requested, Apache will serve the smaller of common.css and common.js if both files exist.

For now I've set my deploy scripts up to rename the files after jammit runs, but I thought I'd mention it here as well.

jashkenas commented 13 years ago

Thanks for mentioning it here ... Apache content-negotiation seems awful to work with when compared with the simplicity of Nginx's static-gzip module. Good luck with it.