limit_access inconsistency/issues

Francis Daly francis at daoine.org
Wed Feb 9 17:41:39 MSK 2011


On Wed, Feb 09, 2011 at 12:37:18PM +0000, Pavel Kolla wrote:

Hi there,

> I am trying to use limit_access to control availability of some locations  via 
> certain methods 

> 	limit_except    GET
> 
> # curl -I -X GET pkolla:88/t/index.html
> HTTP/1.1 200 OK
> # curl -I -X POST pkolla:88/t/index.html
> HTTP/1.1 403 Forbidden

> 	limit_except    POST
> 
> # curl -I -X GET pkolla:88/t/index.html
> HTTP/1.1 403 Forbidden
> # curl -I -X POST pkolla:88/t/index.html
> HTTP/1.1 405 Not Allowed

> IMHO in first case responses should be 200/405 and in second 405/200, even if 
> access returns 403 rather than 405 (being related to http_access_module ) it 
> still should be consistent and return 200 for POST in second case instead of 
> 405.
> 
> Am i totally missing the concept or there is something else i didn't get?

Access returns 403, as you saw. If you want 405, you could add

        error_page 403 = @my405;

to this location, with 

        location @my405 {
            return 405;
        }

nearby.

And the nginx static module doesn't allow POST to files, which is why
you see the 405. Add a working POST handler to this location, such as with

        fastcgi_pass  unix:/var/run/fcgiwrap.socket;
        include fastcgi.conf;

and suitable other files, and you'll see the 200.

All the best,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list