Hi. How can I set the maximum number of request a user can make to my API to 5 or 10 for every 100 seconds? If this limit is crossed then I want to return http error status 429 to the requests of that user. Meanwhile I want other users to be able to make api requests and receive proper responses if their number of requests is within 5 or 10 per 100 seconds. How can this be done?
to prevent abuse, You cannot alter maximum number of requests.
Please note Hosting Api on this hosting isn’t allowed.
Generally speaking, rate limiting can either be done on the server level or within your application code.
Server level rate limiting is fast and light weight, but isn’t very fine grained. To my knowledge, you’ll need to use your own server for this, or use a service which lets you do this (Cloudflare has rate limiting as a paid addon).
Application level rate limiting is more fine grained, but also means that your application code is hit, even for requests which go over the limit. You’ll probably want some kind of memory store like Redis or Memcached to efficiently track these calls. Both free and premium hosting don’t have this.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.