Skip to content

Comments

[fix/socket-chat] - 웹소켓 쿠키전달#38

Merged
ramong26 merged 3 commits intodevelopfrom
fix/socket-chat
Feb 7, 2026
Merged

[fix/socket-chat] - 웹소켓 쿠키전달#38
ramong26 merged 3 commits intodevelopfrom
fix/socket-chat

Conversation

@ramong26
Copy link
Collaborator

@ramong26 ramong26 commented Feb 7, 2026

  1. 기존 gateway에 쿠키 전달하는 로직이 강화되었습니다
  2. 프리뷰 환경에서도 백엔드 api를 이용하도록 도메인 허용하였습니다.

Summary by CodeRabbit

릴리즈 노트

  • 버그 수정
    • WebSocket 채팅 연결의 CORS 허용 범위를 확장하여 로컬 개발 환경과 Vercel 서브도메인에서의 연결을 허용합니다.
    • 채팅 연결 시 토큰 추출 로직을 개선하여 쿠키에 토큰이 없을 때 추가 경로에서 토큰을 읽고 디코딩 오류를 안전하게 처리합니다.

@ramong26 ramong26 self-assigned this Feb 7, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 7, 2026

📝 Walkthrough

Walkthrough

WebSocket 및 HTTP 서버의 CORS origin 허용 범위가 확장되었습니다(vercel 서브도메인 패턴 추가). WebSocket 연결 시 토큰 추출 로직이 개선되어 쿠키에 없는 경우 handshake.auth.token에서 URL 디코딩을 시도하고 디코딩 오류를 로깅하도록 추가되었습니다. 공개 API/시그니처 변경은 없습니다.

Changes

Cohort / File(s) Summary
WebSocket CORS 및 토큰 추출
src/chat/gateways/chat.gateway.ts
WebSocketGateway의 CORS 설정에 allowedHeaders: ['Content-Type', 'Authorization', 'Cookie'] 추가. 연결 시 토큰이 쿠키에 없으면 handshake.auth.token에서 가져와 decodeURIComponent를 시도하고 디코딩 오류를 로그에 기록하도록 토큰 추출 로직을 확장함.
서브도메인 허용 패턴 추가 (HTTP CORS)
src/main.ts
CORS 허용 origin 목록에 정규식 /https:\/\/whatlunch-.*\.vercel\.app$/을 추가하여 vercel 서브도메인들을 허용하도록 확장함.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 창가에 앉아 박자 맞추네,

토큰 한 줌과 헤더 세 알을 들고.
알싸한 바람에 서브도메인 춤추고,
문이 조금 더 넓게 열렸구나. ✨


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

- 프리뷰 배포도 백엔드 api 이용가능하도록 설정
Copy link
Contributor

@Parkchanyoung0710 Parkchanyoung0710 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다.

@ramong26 ramong26 merged commit 30e85b5 into develop Feb 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants