From 56fb3325062a0cdaba65cc97996fa01456f22ae1 Mon Sep 17 00:00:00 2001 From: Anxo Rodriguez Date: Thu, 20 Jun 2024 16:20:32 +0200 Subject: [PATCH] Fix overriding cache headers (#41) --- apps/api/src/app/routes/proxies/coingecko/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/api/src/app/routes/proxies/coingecko/index.ts b/apps/api/src/app/routes/proxies/coingecko/index.ts index 108e759..10ceb93 100644 --- a/apps/api/src/app/routes/proxies/coingecko/index.ts +++ b/apps/api/src/app/routes/proxies/coingecko/index.ts @@ -23,13 +23,14 @@ const coingeckoProxy: FastifyPluginAsync = async ( }), // Response headers https://github.com/fastify/fastify-reply-from?tab=readme-ov-file#rewriteheadersheaders-request rewriteHeaders: (headers, request) => { + // Drop some headers const newHeaders = DROP_HEADERS.reduce((acc, header) => { delete acc[header]; return acc; }, { ...headers, - ...(headers.cacheControl + ...(headers[CACHE_CONTROL_HEADER] ? { [CACHE_CONTROL_HEADER]: getCacheControlHeaderValue(CACHE_TTL), }