Expires + if + break

Alexander Staubo alex at purefiction.net
Wed Oct 31 16:48:33 MSK 2007


This results in the Expires header being set correctly:

  location / {
    if ($request_uri ~ ^/images/.*$) {
      expires max;
      break;
    }
    if (-f $request_filename) {
      break;
    }
    proxy_pass http://mongrel;
  }

This does not:

  location / {
    if ($request_uri ~ ^/images/.*$) {
      expires max;
    }
    if (-f $request_filename) {
      break;
    }
    proxy_pass http://mongrel;
  }

In other words, the "expires" works only if I break within the "if"
block. Doesn't Nginx simply execute all "ifs" in order?

$ /usr/sbin/nginx -v
nginx version: nginx/0.4.13
built by gcc 4.1.2 20061115 (prerelease) (Debian 4.1.1-20)

Alexander.





More information about the nginx mailing list