limit_req per subnet?

Francis Daly francis at
Wed Jan 4 18:32:41 UTC 2017

On Mon, Jan 02, 2017 at 07:43:38AM -0800, Grant wrote:

Hi there,

> > For example:
> >
> >   map $binary_remote_addr $bin_slash16 {
> >     "~^(?P<a>..)..$" "$a";
> >   }
> >
> > will probably come close to making $bin_slash16 hold a binary
> > representation of the first two octets of the connecting ip address.

> That sounds like a good solution.  Will using map along with a regex
> slow the server down much?

The usual rule is that if you do not measure the slow-down on your test
system, then there is not a significant slow-down for your use cases.

Good luck with it,

Francis Daly        francis at

More information about the nginx mailing list