From 000c079c29aede68c228531643d555a5ba684d10 Mon Sep 17 00:00:00 2001 From: pheralb Date: Tue, 5 Aug 2025 12:30:59 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Trying=20to=20fix=20COR?= =?UTF-8?q?S=20error,=20use=20it=20to=20global=20routes=20+=20clean=20redi?= =?UTF-8?q?s=20url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api-routes/src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api-routes/src/index.ts b/api-routes/src/index.ts index d941a06..74b6109 100644 --- a/api-routes/src/index.ts +++ b/api-routes/src/index.ts @@ -40,9 +40,10 @@ class RedisRateLimiter { UPSTASH_REDIS_URL: string; UPSTASH_REDIS_TOKEN: string; }>(c); + const cleanRedisUrl = UPSTASH_REDIS_URL.replace(/^['"]|['"]$/g, '').trim(); const redisClient = new Redis({ token: UPSTASH_REDIS_TOKEN, - url: UPSTASH_REDIS_URL + url: cleanRedisUrl }); const ratelimit = new Ratelimit({ redis: redisClient, @@ -63,7 +64,7 @@ app.use(async (c, next) => { await next(); }); -app.use('/api/*', cors()); +app.use(cors()); // 🌱 GET: "/" - Returns all the SVGs data: app.get('/', async (c) => {