nginx rate limiting
This MR introduces some basic rate limiting. I also improved error pages a bit, and with a tip from Bjarni I was able to reduce the amount of if
statements in the nginx rules significantly. We now completely ignore any hkp parameters other than op
and search
.
Requests by email are limited to 1/m and throw a 429 error. Requests by fpr/keyid are limited to 5/s and just delay. Both have fairly high allowed burst rates.
This is currently deployed on https://testing2.keys.openpgp.org, if anyone wants to give it a go. For example, just keep refreshing any of these URIs:
- https://testing2.keys.openpgp.org/search?q=look%40my.amazin.horse
- https://testing2.keys.openpgp.org/pks/lookup?op=index&search=look@my.amazin.horse
- https://testing2.keys.openpgp.org/pks/lookup?op=index&search=D4AB192964F76A7F8F8A9B357BD18320DEADFA11
Rate limit error pages (only on email queries) use status code 429.