Rewrites vs. location, etc.

mike mike503 at
Mon Sep 22 22:07:21 MSD 2008

>From what it appears,

rewrite foo bar last;

Gets processed before any location blocks.

i.e. a request for


with a rewrite of rewrite ^/foo/(.*) /$1 last;

will wind up making it /bar, so the location needs to be

location /bar {


I am having issues with an app that needs a bunch of rewrites, some
pretty generic, and intercepting the request for just one URI path and
passing it on to either a location block that has its own
root/etc/etc, or I am even trying to proxy_pass it to port 81 with
another nginx server {} listening on it so it's a fully isolated

More information about the nginx mailing list