Mostafa Safarian
Mostafa Safarian

Reputation: 73

Throttling only for users, Skip throttle for frontend server and getServerSideProps

I'm developing an app with NestJs where I'm using throttle module for banning abusive requests.

One thing that I couldn't find a clear answer is that if it's going to block abusive requests (for example, more than 20 requests per minute) will it also block the frontend requests made by nodejs server?

I mean getServerSideProps will make a request in every render. If our website has more than 100 visitors per minute, what will be happened in this situation? Considering that

  1. Frontend and backend projects both are on same server with same IP
  2. They are hosted on different servers with different IP addresses

Upvotes: 2

Views: 1837

Answers (1)

omidh
omidh

Reputation: 2822

Your suspicion is valid because @nestjs/throttler does not differentiate between local and remote requests so yes your NextJs server will be blocked quickly.

I'd suggest you to use reverse proxies instead which are more mature and also does not check local requests.

Upvotes: 2

Related Questions