From f1578f3704fccbd250f38da615bf3be8fef31d0f Mon Sep 17 00:00:00 2001 From: Phumrapee Limpianchop Date: Sat, 25 Nov 2023 02:05:00 +0900 Subject: [PATCH] feat: unobscure proxy ip --- src/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/index.ts b/src/index.ts index 3c7fa62..6dd6d07 100644 --- a/src/index.ts +++ b/src/index.ts @@ -13,6 +13,13 @@ const app = new Elysia() rateLimit({ duration: 60 * 60 * 1000, // 1 hour max: 500, // 500 req per hour + generator: (req, server) => { + return ( + req.headers.get('CF-Connecting-IP') ?? + server?.requestIP(req)?.address ?? + '' + ) + }, }) ) .use(