<@U04UQ68083H> How would I rate limit request to r...
# ory-copilot
a
@chilly-king-10285 How would I rate limit request to registration and login endpoints when self-hosting in AWS
b
A message from kapa.ai
When self-hosting Ory Kratos in AWS, it's important to note that Ory Kratos itself does not provide built-in rate limiting for registration and login endpoints. However, there are several approaches you can take to implement rate limiting: 1. API Gateway: You can use AWS API Gateway as a front-end to your Ory Kratos instance and configure rate limiting rules there. 2. Load Balancer: If you're using an AWS Elastic Load Balancer, you can implement rate limiting at this layer. 3. Web Application Firewall (WAF): AWS WAF can be used to create rate-based rules to limit requests. 4. Third-party solutions: You can use services like Cloudflare or Akamai that provide rate limiting and other security features. It's important to note that Ory recommends handling rate limiting, credential stuffing prevention, and DDoS protection at the operational level rather than within Kratos itself. As stated by an Ory team member: [Ory Kratos GitHub Issue](https://github.com/ory/kratos/issues/3037) > "Rate limiting, credentials stuffing, IP rate limiting across multiple nodes, and DoS prevention are very difficult problems to solve (typically cat and mouse type problems) and it makes much more sense to solve them on an operational level with things like Gateway Ratelimiters, JA3 Fingerprinting, Anti Bot detection, API firewalls or services like Cloudflare or Akamai." For self-hosted instances, it's the responsibility of the administrator to implement and manage appropriate measures to maintain a secure environment. If you need further assistance with implementing these solutions, you may want to reach out to [Ory Support](https://www.ory.sh/docs/kratos/concepts/security).
a
@chilly-king-10285 How much should the rate limit be?
b
A message from kapa.ai
Based on the information provided in the knowledge sources, I cannot give you a specific rate limit value for self-hosted Ory Kratos instances. The knowledge sources do not contain detailed information about recommended rate limits for self-hosted deployments. However, I can provide some relevant information about rate limits in the Ory Network, which might serve as a reference point: [Ory Network Rate Limits](https://www.ory.sh/docs/guides/rate-limits#project-rate-limits-in-workspaces) shows that rate limits in Ory Network depend on the subscription plan and project environment. For example, in the Production plan: - For the Production environment, the
/sessions/whoami
endpoint has a burst limit of 80 requests per second (rps) and a sustained limit of 1800 requests per minute (rpm). - For Staging & Development environments, the same endpoint has a burst limit of 10 rps and a sustained limit of 30 rpm. It's important to note that these limits are specific to Ory Network and may not be directly applicable to self-hosted deployments. When self-hosting, you have the flexibility to set rate limits based on your specific needs and infrastructure capabilities. For a self-hosted deployment, the appropriate rate limit would depend on various factors such as: 1. Your expected traffic volume 2. Your infrastructure capacity 3. The specific endpoints you're protecting 4. Your security requirements If you need more specific guidance for your self-hosted deployment, it would be best to consult with Ory support or a security expert who can assess your particular use case and infrastructure.