Re: Ограничить location uri+агрументы через limit req

Лазовский Вадим lvm на rkmail.ru
Вт Ноя 2 12:52:50 MSK 2010


02.11.2010 12:33, igor.goncharenko пишет:
> Hi!
>
> Подскажите, как установить лимит для
> таких запросов:
> "http://test.host/index.php?command=test_commandPHPSESSION={php session
> id}"
>
> Я сделал location, но он не работает, скорее
> всего потому, что location работает с uri:
>
> location ~* ^/index.php\?command=test_command&PHPSESSID=
>   {
>   proxy_pass          http://test.loc;
>   limit_req zone=test1 burst=5 nodelay;
>    }
>
>
> Попробовал через if в location /:
>
> location  /
>   {
>   proxy_pass          http://test.loc;
>
> if ($request_uri ~* "^/index.php\?command=test_command&PHPSESSID=")
> {
> limit_req zone=test1 burst=5 nodelay;
> }
>
> }
>
> но  тоже не работает:
> # nginx -t
> [emerg]: "limit_req" directive is not allowed here in
> /usr/local/etc/nginx/test.loc:33
>
>
> Подскажите, где я ошибаюсь?
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?21,146826,146826#msg-146826
>
>
> _______________________________________________
> nginx-ru mailing list
> nginx-ru at nginx.org
> http://nginx.org/mailman/listinfo/nginx-ru

А если так?

location / {
	error_page 417 = @limit;

	if ($arg_sessid) {
		return 417;
	}
}

location @limit {
	limit_req ...;
}

-- 
С уважением,
Лазовский Вадим



Подробная информация о списке рассылки nginx-ru