Questions tagged [express-rate-limit]
33 questions
5
votes
1 answer
express-rate-limit with static
I have VPS with express and react bundle.
The problem is that I get the same IP address (localhost) when I access the API from the frontend, therefore I cannot correctly use the express-rate-limit.
I have an express server:
const apiLimiter =…

Jon
- 148
- 2
- 10
4
votes
3 answers
getting SyntaxError: Unexpected token '?' when using 'express-rate-limit'
I am trying make use of 'express-rate-limit' and for some reason when running the server I am getting SyntaxError: Unexpected token '?' even though I am pretty sure my script does not have any syntax error.
Here is de code:
rateLimiter.js
const…

Diego
- 386
- 4
- 19
3
votes
0 answers
Limiting Axios outgoing requests to an external API (Rate Limiting)
I am working with several APIs on my app and a few of them have limits that are not just simply per sec.
For example one of my apis has the following limits:
Max 100 requests per 2 minutes
Max 20 requests per 1 second
So I have tried implementing…

Darkbound
- 3,026
- 7
- 34
- 72
2
votes
2 answers
Redis error "NOSCRIPT No matching script. Please use EVAL" on Redis service restart
I'm using Redis with express-rate-limit and rate-limit-redis in my node ExpressJS server.
The problem I'm facing is that when my Redis server restarts (I know that is something shouldn't happen, but, let's just think it might happen eventually), it…

daniegarcia254
- 1,157
- 4
- 17
- 36
2
votes
1 answer
Can I set multiple rate limits for the same routes with express-rate-limit?
Can I set a global rateLimit for my express server and also set a more restrictive rateLimit for some routes?
For example:
const globalLimit = rateLimit({
windowMs: 60 * 60 * 1000, // 1 HOUR
max: 500 // MAX 500…

cbdeveloper
- 27,898
- 37
- 155
- 336
1
vote
1 answer
how to use express-rate-limit as middleware in strapi custom route
I am trying to add a middleware in strapi custom route which can control how many requests can come from a specific IP> For this I am using express-rate-limit but its not working
I tried this:
const rateLimit =…

Mohsin Tariq
- 11
- 1
1
vote
1 answer
How to use express-rate-limit to limit the amount of requests not for all users but only per user?
Im using express-rate-limit to limit the amount of requests but I want it to be per user. As of now its being applied to all users. I do get the ip address from req.ip and thought that using keyGenerator and returning the ip would make it be per…

learncode
- 127
- 6
1
vote
1 answer
How to add Rate Limiter in all APIs inside the server on Nuxt 3?
I've been trying to add rate limiter to my APIs on Nuxt 3 but I can't seem to figure it out. I am using the express-rate-limit module.
In my middleware. /server/middleware/rate-limiter.ts
import rateLimit from 'express-rate-limit'
const limiter =…

Silver
- 71
- 6
1
vote
1 answer
block user ip in node js middleware
i want to use express-rate-limiter in a middleware of my node.js app. how can i?
in a usuall app, it's in the server.js but i want to blcok user in a middleware.
thanks for your responses
const express=require('express');
const…

soheil
- 31
- 4
1
vote
1 answer
Why does my middleware function not work if its called function is not defined in the same file?
I am facing the following problem :
Case 1 (working case) :
file middleware.ts (library for middleware utils functions)
import { NextApiRequest, NextApiResponse } from 'next'
import rateLimit from 'express-rate-limit'
export function…

Sylvain
- 113
- 1
- 7
1
vote
0 answers
Redis key TTL becoming -1 even when expiry is being set in a multi transaction
We use a rate limiting system which is a slight modification of rate-limit-redis npm. Instead of setting expiry after the multi transaction, which is not atomic, we introduced a 'set' command before 'incr'. The code for the same is:
options.client
…

Mish Nia
- 31
- 1
- 7
1
vote
0 answers
express rate limit for login route
my aim is 10 tires before lockout for 10 minutes. and if the user tries again and has 5 more failed attempts the lock time increase to 20 minutes. after 20 minutes, if the same user has 3 failed attempts lockout is 1 hour and finally, After 1 hour…

freelanceing mindset
- 172
- 1
- 10
1
vote
0 answers
Is it possible to use app.use inside the if else statement in Express
I want to check whether user is logged in or not. If the user is not logged in I want to restrict the access. I've used express-rate-limit and setting the rate limit inside if statement but its not working.
It works fine I put that outside if
Any…

Rajan
- 95
- 12
0
votes
1 answer
Node Express : Does limiting the amount of requests with express-rate-limit work without wifi but with cellular network ip on mobile device?
Im wondering if user has no wifi and is only using his cellular network on his mobile device, the rate limiting will work / will there be a req.ip ?
const rateLimit = require('express-rate-limit')
const apiLimiter = rateLimit({
windowMs: 15 *…

learncode
- 127
- 6
0
votes
0 answers
How to rate limit bulk axios.all and axios.spread requests?
I can't seem to find any documentation or Stack Overflow examples on how to rate limit bulk requests using axios.all to make concurrent requests. I've come across axiom-rate-limit on GitHub and I've found quite a few examples of how to implement…

kiddslopp
- 95
- 1
- 8