allow/deny for a single location, with other location handler

Robert Bunting robert at
Sat Feb 2 06:04:19 MSK 2008


I'm using nginx to proxy through to apache, with a simple

     location / {
         proxy_pass ...

However, there is one location ( /account/sync_profile/) which I'd like 
to restrict to just one IP address.

If I add a location for that address,
location /account/sync_profile/ {
     deny all;

then of course it doesn't get handled by the proxy.

I can't put an
if ($uri = /account/sync_profile) { allow; deny all; }
inside my main location, since allow, deny won't work there.

I can't use a multi-level if;

I suppose one solution would be to include the proxy config into the 
restricted location as well, but this seems like unnecessarily verbose..

Any ideas?


More information about the nginx mailing list