[PATCH] Conditional application of limit_conn directive

turchanov at farpost.com turchanov at farpost.com
Tue Sep 22 14:39:32 UTC 2020


Maxim Dounin писал 2020-09-22 23:19:
> Quoting the documentation (http://nginx.org/r/limit_conn_zone):
> : Requests with an empty key value are not accounted.
> That is, limit_conn can be used conditionally without any
> code changes.  The same applies to limit_req.

Yes, I know about that feature. The problem with that approach is a 
complication of the
process to compute the value of a "key". We tried that before (with a 
cascade of "map" directives)
and configuration became unreadable and very hard to understand when you 
add another indirection
level to force a "key" to be an empty value depending on another 
condition. That was an incentive
for this patch.
This is especially true when there are several "limit_conn" directives 
in one location
to limit user sessions by different identification attributes (and all 
of those attirbutes
need to be "emptied" on a condition).

With best regards,
Sergei Turchanov.

More information about the nginx-devel mailing list