Welcome! Log In Create A New Profile

Advanced

Re: Setting expires header bypasses app server

April 01, 2009 01:06PM
On Wed, Apr 1, 2009 at 3:34 AM, nmk <nginx-forum@nginx.us> wrote:

>    if (!-f $request_filename) {
>      proxy_pass http://thins;
>      break;
>    }
>
>    location ~* \.(js|css|jpg|jpeg|gif|png)$ {
>      if (-f $request_filename) {
>        expires      max;
>        break;
>      }
>    }
>
>  }
>
>
> When request /javascripts/foo.js on the production app (hitting nginx) a 404 is returned directly instead if the request being passed to the app servers. I would expext the request to be passed to the app servers as the file is not on the filesystem. Why doesn't the !-f $request_filename condition (lines 15-18) apply?
>
> If I remove the last portion of the nginx config file (the one which adds an expires header to static files) all works as expected.
>
> Any idea what might be wrong?

It's because it is matching that regexp first.

You could do your if (-f ) check inside of there and it would probably
work, but that's kind of messy. I'm sure Igor can post and give you a
much cleaner way to do the entire thing. Location blocks confuse the
hell out of me sometimes.
Subject Author Posted

Setting expires header bypasses app server

nmk April 01, 2009 06:34AM

Re: Setting expires header bypasses app server

mike April 01, 2009 01:06PM

Re: Setting expires header bypasses app server

nmk April 02, 2009 01:41PM

Re: Setting expires header bypasses app server

mike April 02, 2009 02:20PM

Re: Setting expires header bypasses app server

Cliff Wells April 02, 2009 03:41PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 290
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready