Socketio Cross-Origin Request Blocked error with PM2
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
What's going wrong?
I am using PM2 with cluster mode for my node application. I follow socketio code example (https://socket.io/docs/v4/cluster-adapter/#With-PM2 ).
After that I am getting Cross-Origin Request Blocked error. If I run application on two node, then I am getting 200 for some request and for rest getting error.

I also follow socketio documentation (https://socket.io/docs/v4/handling-cors/) to resolve this issue but no luck. following is my code for that
const httpServer = createServer(app);
const io = new Server(httpServer,{
cors: {
origin: ["*"],
methods: ["GET", "POST"],
credentials: true
},
transports: ["polling"],
allowEIO3: true
});
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the PM2 cluster adapter example and Socket.IO's CORS documentation linked in the issue, then reproduce the behavior with two Node processes, polling, and the shown server options. Done means identifying whether the intermittent CORS failures come from PM2 clustering or the Socket.IO configuration and documenting a verified resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend, devops, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100