Skip to content

CORS origin configuration can break sockets#288

Merged
omkarhole merged 2 commits into
omkarhole:mainfrom
Aditya8369:253
Jun 4, 2026
Merged

CORS origin configuration can break sockets#288
omkarhole merged 2 commits into
omkarhole:mainfrom
Aditya8369:253

Conversation

@Aditya8369

Copy link
Copy Markdown
Contributor

Fixed potential socket connection failures caused by brittle Socket.IO CORS origin matching.

Updated backend/server.js:

Added parseOriginsEnv() to robustly parse FRONTEND_URL / FRONTEND_URLS (handles empty/malformed values; trims; removes trailing slashes; filters invalid entries).
Kept HTTP CORS using the normalized origin list.
Changed Socket.IO cors.origin from a static list to a normalization-aware function matcher, so slight origin formatting differences no longer break socket connections.
Made allowed-origin logging development-only (NODE_ENV === 'development').
Verification:

Ran npm test in backend/ successfully (12 tests passed).
Progress tracked:

Modified backend\server.js

closes #253

@vercel

vercel Bot commented Jun 4, 2026

Copy link
Copy Markdown

@Aditya8369 is attempting to deploy a commit to the omkarhole's projects Team on Vercel.

A member of the Team first needs to authorize it.

@omkarhole omkarhole merged commit 16f6888 into omkarhole:main Jun 4, 2026
0 of 2 checks passed
@omkarhole omkarhole added NSOC'26 Issues for the NSOC 2026 program level3 10 points labels Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level3 10 points NSOC'26 Issues for the NSOC 2026 program

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: CORS origin configuration can break sockets

2 participants