Maximum URL length and the limit_zone module

Igor Sysoev is at rambler-co.ru
Fri Aug 10 10:00:59 MSD 2007


On Thu, Aug 09, 2007 at 01:31:57PM +0100, Just Marc wrote:

> I have some long non-English file names that when url-encoded and 
> prepended with a path, exceed the 255 limit check in the limit_zone module:
> 
> 
> I am using limit_zone like so:
>    limit_zone   one  $request_uri   10m;
> 
> 
> http/modules/ngx_http_limit_zone_module.c:ngx_http_limit_zone_handler
> 
>    if (len > 255) {
>        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
>                      "the value of the \"%V\" variable "
>                      "is more than 255 bytes: \"%V\"",
>                      &ctx->var, vv);
>        return NGX_DECLINED;
>    }
> 
> Is there any special reason to limit this to 255 bytes?   I think this 
> can be increased safely, no?

It can be increased to 65536.

> Is there a way to hash the request_uri and use that for limit_zone?

$request_uri is (as in Apache) unparsed uri+args. I do not think that is
good key. It's better to use $uri - it already decoded (so it may be
up to 3 times less) and without $args.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list