Maximum URL length and the limit_zone module
Igor Sysoev
is at rambler-co.ru
Fri Aug 10 10:57:26 MSD 2007
On Fri, Aug 10, 2007 at 07:19:54AM +0100, marc at corky.net wrote:
> Hi,
>
>
> Igor Sysoev wrote:
> >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.
> >
> >
>
> Great
>
> >>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.
> >
> >
>
> I have this code, where post_action is supposed to run /done when the
> request ends:
>
> location /protected/ {
> internal;
>
> alias /;
> post_action /done;
> }
>
> Unfortunately, it seems that "/done" is what is passed as $uri to
> limit_zone. Is there anything else I can do?
>
> Marc
>
> Unfortunately in my test it appears to be getting only "/done":
BTW, why do you use limit_conn in post_action ?
You should use it in /protected/ only or even before X-A-R.
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list