Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize api nginx to rate-limit bots #648

Open
auspicacious opened this issue Apr 1, 2020 · 3 comments
Open

Customize api nginx to rate-limit bots #648

auspicacious opened this issue Apr 1, 2020 · 3 comments

Comments

@auspicacious
Copy link
Contributor

We should both:

  • Set up nginx rate-limiting to automatically slow down crawlers, bots, etc.
  • Create a pattern to allow us to explicitly block IPs or IP address ranges

This should be accomplished through .ebextensions.

@sasharevzin
Copy link
Collaborator

I would suggest using middleware https://github.com/kickstarter/rack-attack
PS. I understand that it's better to do it via Nginx, so the request won't even ping the app, but rack-attack is way more convenient with all its options, and it's a middleware, so that rails won't be loaded. Currently using for https://streeteasy.com/ and it works great

@auspicacious
Copy link
Contributor Author

It's interesting code, but I feel like nginx is a more general solution that we can re-use in other places in the future easily. Plus it's pretty easy to do with Elastic Beanstalk.

@auspicacious
Copy link
Contributor Author

I thought I would restate our priorities a little:

These two will require the nginx rate limiting module:

  • Automatically rate limit IP addresses that are making too many requests too quickly
  • Allow certain IP addresses to be whitelisted to make more requests without limiting (e.g. https://realtime.safecast.org/)

These two can be accomplished with more basic nginx configuration:

  • Make it easy to completely block specific IP addresses
  • Make it easy to completely block specific user-agents (this has been useful in the past)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants