Skip to content

Commit

Permalink
fix: add the exact route to socket cors origin (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
romansharapov19 authored Aug 2, 2023
1 parent afaff98 commit 9b4305f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/api/src/chats/adapters/redis-io.adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class RedisIoAdapter extends IoAdapter {
}

createIOServer(port: number, options?: ServerOptions): any {
options.cors = { origin: this.configService.get('FRONTEND_ORIGIN_URL') };
const server = super.createIOServer(port, options);
server.adapter(this.adapterConstructor);
return server;
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/chats/chat-socket.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Server, Socket } from 'socket.io';

@WebSocketGateway({
cors: {
origin: '*',
credentials: true,
},
})
export class ChatSocketGateway {
Expand Down

0 comments on commit 9b4305f

Please sign in to comment.