Skip to content

Conversation

@kalee88
Copy link

@kalee88 kalee88 commented Jan 6, 2024

In the top layer I have added the middleware.ts file that runs prior to a completed request. The middleware.ts file fetches the rate-limit page and returns if the limit is reached. If the limit is reached, it will redirect to the 429.ts error page; if not the request continues. The ratelimit.ts file keeps track of the number of request per time period and delays if excessive request are called within a short time frame. The counter for number of requests within a time period utilizes the Express library from node.js and can be IP based. However it cannot access the client's IP due to the next.js framework hiding it.

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

Successfully merging this pull request may close these issues.

1 participant