Nginx HttpAccessModule command invalid when rewrite command existed

In the following simple case:

location /entry1 {
allow 127.0.0.1;

}

In the following simple case:

location /entry1 {
allow 127.0.0.1;
deny all;
rewrite ***;
}

the allow/deny command has no effect. Is that because rewrite command
works
in the earlier phase?

Thanks!

On Wed, Nov 09, 2011 at 10:35:44PM +0800, li zJay wrote:

In the following simple case:

location /entry1 {
allow 127.0.0.1;
deny all;
rewrite ***;
}

the allow/deny command has no effect. Is that because rewrite command works
in the earlier phase?

Yes, rewrites run before allow/deny.


Igor S.

Thanks Igor. That is OK, and I had a think and use the following
commands
instead:

location /entry1 {
if ( ! $remote_addr ~ “^(127.0.0|10.10.10)” ) { return 403; }
rewrite ***
}