On Fri, Sep 16, 2011 at 01:32:10AM -0500, Patrick A. wrote:
Any idea how I could fix this?
Please show request and response. (And please make sure you
actually see request in nginx logs, i.e. don’t test your browser’s
cache.)
If request actually hits nginx in question, I see two most likely
reasons:
Your request is processed in location where you don’t have
“expires max;” set. I.e. request doesn’t match /images/ etc.
Your request is processed in another server block.
On Fri, Sep 16, 2011 at 11:49:34AM +0200, Mahalingam Mr wrote:
expires max;
}
Solution:
Try this instead of giving the folders explicitly.,
No, this is bad idea. Using regexp locations is bad as it makes
configuration support much harder. Using separate prefixes for
static files is much more scalable aproach.
Additionally, this particular snippet is incorrect and misleading
in serveral ways.
On Fri, Sep 16, 2011 at 03:29:23PM -0500, Patrick A. wrote:
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?
Either set it from app, or pass to app while still setting
expires. Something like this should work:
If some data in /_files/ may be actually static files on disk, you
may want to add try_files with named location, much like in
“location /” + “location @app” in your config, but with expires
set. I.e. something like this:
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?
Thanks,
Pat
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.