Files
DongHyeonkaandClaude Opus 5 bcb563a04e docs: B-7 — the cookie secret has no overlap window and rotation orphans sessions
oauth2-proxy carries the authorization request in a signed cookie, so the callback can land on a different replica and still succeed, which is the opposite of the BFF failure in B-0. Sharing is therefore just sharing one Secret.

Rotating it is all-or-nothing: --cookie-secret is singular, so there is no second key to read old tickets with, and the log shows both the validation failure and Error removing session, leaving the Redis session orphaned because the key cannot be derived from a ticket that will not decode.

Getting there required two diagnoses: the callback 502 came from the full session riding in Set-Cookie past nginx's buffer, and every earlier attempt to read nginx config returned nothing because sudo on the host asks for a password while the guests do not.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 14:44:00 +09:00
..

B-7 — oauth2-proxy cookie secret 교체 증거

2026-09-04 16:0016:15 KST 해설: docs/experiment-b7-cookie-secret-rotation.md

파일 무엇을 보여주는가
01-deploy.txt 양 노드에 replica 하나씩. / 302, /ping 200
02-cookie-portability.txt curl 로 흐름을 완주하려던 시도 — 파드 IP 는 호스트에서 안 닿는다
03-rotation.txt --cookie-secret string 단수 확인 · 교체 후 session ticket cookie failed validation · Error removing session · Redis 에 고아 세션 2개
b7-oauth2proxy-login-success.png Redis 세션 전환 후 성공한 Forward-Auth — x-forwarded-user/email/preferred-username티켓 형태 쿠키

핵심 네 줄

  1. BFF 와 정반대다. 인가 요청이 쿠키에 있어 콜백이 다른 replica 로 가도 성공한다 — B-0 에서 BFF 가 실패한 바로 그 지점.
  2. 502 의 원인은 큰 쿠키였다. Traefik 직접은 정상이고 nginx 만 502 — B-4 의 헤더 절벽이 응답 쪽에서 재현됐다.
  3. 겹침 구간을 만들 수 없다. --cookie-secret 이 단수라 B-6 의 무중단 회전이 불가능하다.
  4. 교체하면 서버 세션이 고아로 남는다. 티켓을 못 푸니 지울 수도 없다.