Rewrite issues

I am trying to redirect users to an upgrade page when there is an
“upgrade” file in the location block location. However it seems that it
is not picking up on it.

Here is the configuration.
location / {
if (-f upgrade) {
rewrite ^(.*)
http://media.fabulously40.com/upgrading.html last;
}
… redirect to proxy configuration below …
}

This should work no? if “upgrade” file exists rewrite the request.

Am I missing something here…

-Victor

Victor I. wrote:

I am trying to redirect users to an upgrade page when there is an
“upgrade” file in the location block location. However it seems that it
is not picking up on it.

Here is the configuration.
location / {
if (-f upgrade) {
rewrite ^(.*)
http://media.fabulously40.com/upgrading.html last;
}
… redirect to proxy configuration below …
}

This should work no? if “upgrade” file exists rewrite the request.

Am I missing something here…

-Victor

Okay I figured it out, needed to add break;

    if (-f /opt/jetty/production/fab40/upgrade) {
            rewrite ^(.*)$ /html/upgrade.html last;
            break;
    }

And I added the full path name for good measure.