fix(preview): 평문 HTTP 프리뷰에서 세션 쿠키가 버려지던 문제 - #565
Open
tkdgusqkr wants to merge 1 commit into
Open
Conversation
`serviceOpsCookieSecure()` 가 `NODE_ENV === "production"` 만 보고 Secure 를 붙였다. 프리뷰는 `next start` 라 NODE_ENV 가 production 으로 고정되는데 :8090 은 평문 HTTP 이므로 브라우저가 세션 쿠키를 그대로 버렸다. 로그인 직후 화면은 한 번 그려지고 이후 모든 요청이 /login 으로 튕겼다 — 운영자에게는 "자원 관리를 누르면 오류" 로 보였다. SERVICE_OPS_COOKIE_INSECURE 로 프리뷰에서만 끌 수 있게 한다. 운영 env 에는 절대 넣지 않는다 — 그쪽은 HTTPS 라 Secure 가 반드시 붙어야 한다. provision 스크립트가 프리뷰 env 를 만들 때만 이 값을 쓴다. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
증상
프리뷰(:8090)에서 로그인은 되는데 자원 관리를 누르면 오류 화면이 떴습니다. 실제로는 로그인 직후 화면만 한 번 그려지고, 이후 모든 요청이
/login으로 튕기고 있었습니다.원인
serviceOpsCookieSecure()가NODE_ENV === "production"만 보고 세션 쿠키에Secure를 붙입니다. 프리뷰는next start로 뜨기 때문에NODE_ENV가 production 으로 고정되는데, :8090 은 평문 HTTP 라 브라우저가 그 쿠키를 저장하지 않고 버립니다.document.cookie가 비어 있는 것으로 확인했습니다.수정
SERVICE_OPS_COOKIE_INSECURE=true일 때만Secure를 빼도록 opt-out 을 둡니다.운영 env 에는 절대 넣으면 안 됩니다. 운영은 HTTPS 이므로
Secure가 반드시 붙어야 하고, 이 값이 켜지면 세션 쿠키가 평문으로 오갈 수 있습니다. 코드와 스크립트 양쪽에 그 경고를 주석으로 남겼고,provision-console-preview.sh는 프리뷰 env 를 만들 때만 이 줄을 씁니다.확인
프리뷰 호스트에 적용 후 로그인 → 자원 관리 → 정비 관리 이동이 세션 유지된 채 정상 동작합니다.
🤖 Generated with Claude Code