documentcloud / jammit

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

"passenger_enabled on" in assets block in nginx config #92

Closed jjb closed 13 years ago

jjb commented 13 years ago

the documentation says to put "passenger_enabled on" in the assets block of the nginx config. Why is this? i am running passenger, and i have that directive inside my server block, and that location block inside the server block as well. it doesn't make sense to me.

(also, is there a jammit mailing list? if so, it's not mentioned anywhere :) )

thanks

john

jashkenas commented 13 years ago

Hi John.

There isn't an external mailing list -- this is the place to ask questions (or in #documentcloud on IRC).

I don't remember exactly why the passenger_enabled on bit is necessary, but I remember that it was, at the time when I added it. It may no longer be needed with Passenger 3.0, and if you run some tests and determine that everything still works correctly without it (dynamic asset caching, expires headers, and so on), I'd be glad to remove that bit from the documentation.

agibralter commented 13 years ago

Oooh I finally figured out the deal with passenger_enabled while messing around with something completely unrelated to Jammit. (I remembered seeing this issue though and that's why I'm returning here to share the knowledge.)

It turns out that Jammit doesn't necessarily need passenger_enabled in the assets location in nginx... nginx will just server the static files in /assets without trouble. However, without passenger_enabled, if you want any route that starts with /assets to fall back to your app, it won't... you'll get the nginx 404 page. So, for example, if you want your app's 404 page when someone goes to http://yourdomain.com/assets/file-that-does-not-exist.js you'll need passenger_enabled on; in the location.

jjb commented 13 years ago

thanks agibralter