[fix] 어드민 로그인 시 localhost:3001로 이동되는 문제 수정#419
Conversation
서버 Host 헤더(`headers().get('host')`)로 어드민 도메인을 판별하던 로직이
스테이지 리버스 프록시 환경에서 내부 호스트(localhost)를 받아 항상
localhost:3001로 리다이렉트되던 문제를 수정한다.
판별 기준을 브라우저 주소창 값인 window.location.origin으로 옮긴 클라이언트
컴포넌트 AdminRedirect로 교체했다. 서버 측 권한 검증(isAdminRole)은 그대로
유지된다.
resolves #418
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
There was a problem hiding this comment.
Code Review
This pull request replaces the server-side redirection logic in page.tsx with a new client-side redirection component, AdminRedirect.tsx. The review feedback suggests reverting to server-side redirection by utilizing the X-Forwarded-Host header to prevent a flash of the loading state and improve user experience. Additionally, it is recommended to remove unnecessary cn utility calls for static Tailwind CSS classes in the new component.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
junjuny0227
left a comment
There was a problem hiding this comment.
코드상으로는 큰 문제 없어 보이긴 하는데, 실제로 적용해봐야 정확히 확인할 수 있을 것 같습니다. 한 분 더 승인받은 뒤에 머지하시죠
개요 💡
스테이지 어드민(
admin.stage.hellogsm.kr)에서 로그인하면 콜백 처리 후http://localhost:3001/로 이동하던 버그(#418)를 수정합니다.원인은 #411에서 어드민 도메인 판별을 환경변수 기반 → 서버 Host 헤더(
headers().get('host')) 기반으로 바꾼 데 있습니다. 스테이지는 리버스 프록시를 통해 내부 호스트(localhost)를 Host로 전달하므로,host.includes('localhost')가 먼저 매칭돼 항상localhost:3001로 리다이렉트됩니다.작업내용 ⌨️
apps/client/src/app/AdminRedirect.tsx신규 추가window.location.origin기준으로 어드민 URL을 판별해 리다이렉트하는 클라이언트 컴포넌트localhost:3001, stage →admin.stage.hellogsm.kr, 운영 →admin.hellogsm.krapps/client/src/app/page.tsx<AdminRedirect />렌더로 교체headersimport 제거 (redirect는/signup분기에서 계속 사용)isAdminRequested && isAdminRole)은 그대로 유지왜 이 방식인가
window.location.origin은 브라우저 주소창 값이라 리버스 프록시의 영향을 받지 않습니다. 또한 이 신호는 이미 동일 플로우의LoginButton(redirectUri 생성)과CallbackPage(/?isAdmin=true생성)에서 정상 동작 중이므로, 검증된 신호를 마지막 리다이렉트에도 그대로 사용하는 변경입니다.관련 이슈 🚨
리뷰 요청사항 👀
admin.stage.hellogsm.kr/signin로그인 → 콜백 후admin.stage.hellogsm.kr로 복귀하는지 확인 부탁드립니다.