Avoid DDoS attacks #471
josecelano
started this conversation in
Feature requests
Replies: 2 comments
-
1. IP Rate Limit@da2ce7 proposed an API rate limit per IPv4 or IPv6 group. More considerations from ChatGPT: To implement a mechanism to avoid DDoS (Distributed Denial of Service) attacks in a REST API by limiting the number of requests per IP (both IPv4 and IPv6), you can follow these general steps: 1. Choose a Rate Limiting Strategy
2. Identify Clients
3. Implementing the Rate Limiter
4. Configure Rate Limiting
5. Handling Over-Limit Requests
6. Monitoring and Adjusting
7. Additional Security Measures
Example Code Snippet (Python Flask)from flask import Flask, request, jsonify
from flask_limiter import Limiter
from flask_limiter.util import get_remote_address
app = Flask(__name__)
limiter = Limiter(app, key_func=get_remote_address)
@app.route("/api/resource")
@limiter.limit("100 per minute")
def my_api():
return jsonify({"message": "This is a rate-limited API response"})
if __name__ == "__main__":
app.run() Considerations
|
Beta Was this translation helpful? Give feedback.
0 replies
-
2. Hashcash for HTTPI don't like the cavets:
Option 1 is better because you can stop only the attacker. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I guess the worst DDoS attack you can do is to upload millions of torrents to the Index.
That can be done easily with the
seeder
command implemented here.We could proposal ways to mitigate this type of attack.
Beta Was this translation helpful? Give feedback.
All reactions