diff --git a/app.js b/app.js index 2d32e9a..64282f9 100644 --- a/app.js +++ b/app.js @@ -20,8 +20,10 @@ const server = http.createServer(async (req, res) => { const ip = req.headers['x-forwarded-for'] || req.socket.remoteAddress; if (ip && await limited(ip)) { - res.writeHead(429); + console.log('limited') + res.writeHead(429, headers); } else { + console.log('not limited') res.writeHead(200, headers); if (req.url === '/asset_prices') { res.end(JSON.stringify(await getPrices())); diff --git a/src/rate.js b/src/rate.js index 56a0b02..de22c54 100644 --- a/src/rate.js +++ b/src/rate.js @@ -13,7 +13,7 @@ const limited = async ip => { console.log(ip) const key = `rateLimit:${ip}` console.log(2) - const reqLimit = 100; + const reqLimit = 10; console.log(3) await redis.connect(); console.log(4)