Welcome! Log In Create A New Profile

Advanced

Using http_limit_conn with a custom variable

Kevin Burke
May 21, 2013 03:32PM
Hi,
We're trying to use the limit_conn_zone directive to throttle incoming
HTTP requests.

We'd like to throttle based on the http basic auth variable
($remote_user), however, we must do processing on this value so the
zone does not overflow with illegitimate values. Ideally we'd want to
do something like

set $safe_remote_user "";
content_by_lua '
-- Some code to filter $remote_user values, simplified to one line here
ngx.var.safe_remote_user = $remote_user
'
limit_conn_zone $safe_remote_user zone:user 10m;

However this runs into a problem that we can only set variables inside
of the location context, but limit_conn_zone must be defined in the
http context. So, as we understand it we cannot use a variable defined
by lua in the limit_conn_zone directive. We were curious if anyone has
run into this problem, and if there are workarounds that could help us
solve this problem.

Thanks,
Kevin

----
Kevin Burke | 415-723-4116 | www.twilio.com

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Using http_limit_conn with a custom variable

Kevin Burke May 21, 2013 03:32PM

Re: Using http_limit_conn with a custom variable

Maxim Dounin May 22, 2013 10:00AM

Re: Using http_limit_conn with a custom variable

Kevin Burke May 22, 2013 10:36AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 131
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready