From 2f0d6b32ba72bf8b3c0bfe8668193c956ff9e224 Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Thu, 8 Apr 2021 20:15:25 -0500 Subject: add Access-Control-Allow-Origin * and change ratelimit to be stricter --- src/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/index.ts') diff --git a/src/index.ts b/src/index.ts index d997cde..274df36 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,10 +7,10 @@ const app = express() export const debug = false -// 500 requests over 5 minutes +// 200 requests over 5 minutes const limiter = rateLimit({ windowMs: 60 * 1000 * 5, - max: 500, + max: 200, skip: (req: express.Request) => { return req.headers.key === process.env.key }, @@ -20,6 +20,10 @@ const limiter = rateLimit({ }) app.use(limiter) +app.use((req, res, next) => { + res.setHeader('Access-Control-Allow-Origin', '*') + next() +}) app.get('/', async(req, res) => { res.json({ ok: true }) -- cgit