fix(sw): /dashboard, /login 경로 SW fetch에서 제외 — 리다이렉트 루프 방지

SW가 /dashboard fetch → nginx proxy → gateway → 응답 →
SW가 다시 fetch → 무한 루프. 프록시 경로는 SW 캐싱에서 제외.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-04-01 15:47:32 +09:00
parent 7db072ed14
commit f28922a3ae

View File

@@ -20,10 +20,12 @@ self.addEventListener('activate', function(event) {
}); });
self.addEventListener('fetch', function(event) { self.addEventListener('fetch', function(event) {
// API, POST, cross-origin 요청은 캐싱하지 않음 // API, POST, cross-origin, 로그인/대시보드 프록시 경로는 캐싱하지 않음
if (event.request.url.includes('/api/')) return; if (event.request.url.includes('/api/')) return;
if (event.request.method !== 'GET') return; if (event.request.method !== 'GET') return;
if (!event.request.url.startsWith(self.location.origin)) return; if (!event.request.url.startsWith(self.location.origin)) return;
var path = new URL(event.request.url).pathname;
if (path === '/dashboard' || path === '/login' || path === '/auth' || path.startsWith('/auth/')) return;
event.respondWith( event.respondWith(
fetch(event.request) fetch(event.request)