Skip to content

Commit

Permalink
Merge pull request #289 from songbuild00/fix-be-cors-and-cookie
Browse files Browse the repository at this point in the history
[BE] fix: CORS Origin ์„ค์ • ๋ฐ ์ฟ ํ‚ค SameSite, Secure ์˜ต์…˜ ์ถ”๊ฐ€
  • Loading branch information
songbuild00 authored Nov 28, 2024
2 parents 5ffc3eb + 42c834b commit 9f24c8c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions BE/src/game/game.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ import { ExceptionMessage } from '../common/constants/exception-message';
@UseInterceptors(GameActivityInterceptor)
@UseFilters(new WsExceptionFilter())
@WebSocketGateway({
// cors: {
// origin: ['*,', 'https://admin.socket.io'], //์ด๋Ÿฌ๋ฉด ๋ฐฐํฌ์—์„œ cors์˜ค๋ฅ˜ ์ƒ๊น€
// credentials: true
// },
cors: {
origin: '*' //์ด๋Ÿฌ๋ฉด ๋ฐฐํฌ์—์„œ admin ui ์ ‘๊ทผ ์•ˆ๋จ
origin: [
'https://news.taskify.shop',
'https://quizground.duckdns.org',
'https://admin.socket.io'
],
credentials: true
},
namespace: '/game'
})
Expand Down Expand Up @@ -179,7 +180,7 @@ export class GameGateway {

setNewPlayerIdToCookie(headers) {
const playerId = uuidv4();
headers['Set-Cookie'] = serialize('playerId', playerId);
headers['Set-Cookie'] = serialize('playerId', playerId, { sameSite: 'none', secure: true });
return playerId;
}

Expand Down

0 comments on commit 9f24c8c

Please sign in to comment.