caddy-ext: Rate limiting by IPv6 block

Hello,

First of all, thank you for a great library that helps rate-limiting the number of requests.

Secondly, I’m having an issue with IPv6 addresses. As you might know that a simple /64 block assigned to customer contains millions of IP addresses and simple rate_limit * {remote.ip} 1r/m just doesn’t work as that customer could just use another IPv6 address from his own block.

Do you have any suggestions or maybe some kind of a feature might be implemented to solve rate-limiting for the IPv6 by blocks as well?

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (10 by maintainers)

Most upvoted comments

Caddy supports a not matcher, you can try this configuration for IPv4 case:

@ipv4 not {  # All IPv4 addresses except Local ones
  remote_ip ::/0  #  not IPv6 addresses
  remote_ip 192.168.1.0/24  # and not local addresses
}
rate_limit @ipv4 {remote.host_prefix.24} 1r/m

Hello,

Sorry about the late reply but everything has been working like a charm! Well the issue I had wasn’t related to this plugin.

I’ll report if any issues will arise.

Thank you!

Hello,

I do really appreciate your help, this works like a charm!

Enabled IPv6 back and deployed to production for a few million of users.

Thank you so much!