can't get cache controle to set an expire date

Patrick Aljord patcito at
Fri Sep 16 20:29:23 UTC 2011

Hey Maxim,

Ok so after investigation I realized that this one worked:


But these two did not have expire cache:


So I added this to the conf:

   location /packages/ {       expires max;   }
   location /_files/ {
       expires max;

This fixed the '/packages/base.js' cache but I started getting a 404
on the '/_files/groups/medium/4af798a119ce955bd1000001/0.png'. So I
removed the "location /_files/" from the conf. The thing is that this
file does not come from the hard drive. It comes from the web app (I'm
using unicorn for rails + nginx). Any idea how I should set the expire
headers for those assets that come from the app? Should I set them in
the rails app?



More information about the nginx mailing list