📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Add Vary for header-dependent responses to prevent cache bypass
Blue Mouse6b99eec197b0
diff --git a/web/app/routes/api.favicon.ts b/web/app/routes/api.favicon.tsindex 039c42462..331cdbb18 100644--- a/web/app/routes/api.favicon.ts+++ b/web/app/routes/api.favicon.ts@@ -8,6 +8,7 @@ const CACHE_TTL = 60 * 60 * 24 * 7 // 7 daysconst STALE_TTL = 60 * 60 * 24 * 30 // 30 daysconst FALLBACK_ICO = '/assets/icons/chain.svg'+const VARY = 'Origin, Referer'function isOriginAllowed(request: Request): boolean {if (isSelfhosted || isDevelopment) return true@@ -20,7 +21,7 @@ function isOriginAllowed(request: Request): boolean {export async function loader({ request }: LoaderFunctionArgs) {if (!isOriginAllowed(request)) {- return new Response(null, { status: 403 })+ return new Response(null, { status: 403, headers: { Vary: VARY } })}const url = new URL(request.url)@@ -48,6 +49,7 @@ export async function loader({ request }: LoaderFunctionArgs) {headers: {'Content-Type': upstream.headers.get('Content-Type') || 'image/x-icon','Cache-Control': `public, max-age=${CACHE_TTL}, stale-while-revalidate=${STALE_TTL}`,+ Vary: VARY,},})} catch {