From cf4f25620dbbde293991b4de6d43342e48c45a48 Mon Sep 17 00:00:00 2001 From: gahusb Date: Fri, 20 Mar 2026 02:02:16 +0900 Subject: [PATCH] =?UTF-8?q?perf:=20stats/performance=20=EC=9D=B8=EC=A6=9D?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0=20+=20CDN=20=EC=BA=90=EC=8B=9C=2010?= =?UTF-8?q?=EB=B6=84=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Supabase auth 왕복 1-2s 제거 (집계 데이터는 인증 불필요) - Cache-Control: s-maxage=600 으로 Vercel Edge CDN 캐싱 적용 - 동일 요청 10분간 NAS 호출 없이 CDN에서 즉시 응답 Co-Authored-By: Claude Sonnet 4.6 --- app/api/lotto/stats/performance/route.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/api/lotto/stats/performance/route.ts b/app/api/lotto/stats/performance/route.ts index 7d856f7..4705be0 100644 --- a/app/api/lotto/stats/performance/route.ts +++ b/app/api/lotto/stats/performance/route.ts @@ -1,15 +1,15 @@ import { NextResponse } from 'next/server'; -import { createClient } from '@/lib/supabase/server'; import { nasGet, handleNasError } from '../../_nas'; +// 공개 집계 데이터 — 인증 불필요, Vercel CDN에서 10분 캐시 export const maxDuration = 60; +export const revalidate = 600; // 10분 export async function GET() { try { - const supabase = await createClient(); - const { data: { user } } = await supabase.auth.getUser(); - if (!user) return NextResponse.json({ error: 'UNAUTHORIZED' }, { status: 401 }); const data = await nasGet('/api/lotto/stats/performance'); - return NextResponse.json(data); + const res = NextResponse.json(data); + res.headers.set('Cache-Control', 's-maxage=600, stale-while-revalidate=60'); + return res; } catch (err) { return handleNasError(err); } }