fix(middleware): 정적 자산(.svg 등)을 인증 리다이렉트에서 제외
This commit is contained in:
+6
-1
@@ -5,11 +5,16 @@ export function middleware(request: NextRequest) {
|
||||
const { pathname } = request.nextUrl;
|
||||
|
||||
// 인증 불필요 경로
|
||||
const publicPaths = ["/login", "/api/auth/login", "/_next", "/favicon.ico"];
|
||||
const publicPaths = ["/login", "/api/auth/login", "/_next", "/favicon.ico", "/icon.svg"];
|
||||
if (publicPaths.some((p) => pathname.startsWith(p))) {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
// 정적 자산(이미지/폰트 등)은 인증 면제
|
||||
if (/\.(svg|png|jpg|jpeg|gif|webp|ico|woff2?|ttf|otf|css|js|map)$/i.test(pathname)) {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
// 세션 쿠키 확인
|
||||
const sessionCookie = request.cookies.get("plm-session");
|
||||
if (!sessionCookie && !pathname.startsWith("/api")) {
|
||||
|
||||
Reference in New Issue
Block a user