From 4df273fa19ca8a860e97bfc94a42ddf3ed6adcf0 Mon Sep 17 00:00:00 2001 From: chpark Date: Fri, 27 Mar 2026 02:07:23 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20API=20=EC=9D=B8=EC=A6=9D=20=EC=8B=A4?= =?UTF-8?q?=ED=8C=A8=20=EC=8B=9C=20401=20=EB=B0=98=ED=99=98=20(=EB=A6=AC?= =?UTF-8?q?=EB=8B=A4=EC=9D=B4=EB=A0=89=ED=8A=B8=20=EB=8C=80=EC=8B=A0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 페이지 이동 후 사이트 목록 빈 화면 버그 수정 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/app.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app.js b/src/app.js index 0017eda..499a12d 100644 --- a/src/app.js +++ b/src/app.js @@ -42,7 +42,10 @@ function adminAuth(req, res, next) { } sessions.delete(token); } - // 로그인 페이지로 리다이렉트 + // API 요청은 401 반환, 페이지 요청은 로그인으로 리다이렉트 + if (req.path.startsWith('/api')) { + return res.status(401).json({ error: 'Unauthorized' }); + } const returnUrl = req.originalUrl; res.redirect('/login?redirect=' + encodeURIComponent(returnUrl)); }