Expiration headers when rewriting requests

Brian Kirkbride brian.kirkbride at deeperbydesign.com
Wed Mar 12 01:11:29 MSK 2008

Igor Sysoev wrote:
> After rewrite nginx uses new location configuration unless you use break:
>  location ~ ^/r[0-9]+/ {
>      expires max;
>      add_header Last-Modified "Thu, 01 Jan 1970 00:00:01 GMT"
> -    rewrite ^/r[0-9]+(/.*)$ $1 last;
> +    rewrite ^/r[0-9]+(/.*)$ $1 break;
>  }
> However, it will not work after fallback to FastCGI.

Thanks you Igor, that is what I thought.  FastCGI is not a problem as 
I can have the Application set the Expires headers correctly in that case.

My problem is that I have things in the "location /" block that need 
to act on /r1234123/... requests after they have been rewritten.  This 
is not possible if I want to retain the expires setting in the 
"location ~ /^r[0-9]+/" block.

I will duplicate the configuration in "location /" to the other 
location block.  That should work, thanks!

- Brian

More information about the nginx mailing list