codeceptjs / codeceptjs/ui

Missing CORS headers

Open
#536 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
84
Forks
30
PR merge metrics
No merged PRs in 30d

Description

I just tried various 1.2.x version and none of them set any CORS headers, so even running on localhost is failing for me due to different ports.

I fixed that locally by editing `node_modules/@codeceptjs/ui/bin/codecept-ui.js` and change

```javascript
const io = require('socket.io')();
```

to

```javascript
const io = require('socket.io')({
cors: {
origin: "http://localhost:3333",
credentials: true,
methods: ["GET", "POST"],
transports: ['websocket', 'polling']
},
allowEIO3: true
});
```

A proper solution would require to make the origin configurable.

Contributor guide

Open the contributing guide

Research direction

Start with node_modules/@codeceptjs/ui/bin/codecept-ui.js and inspect how the Socket.IO server is created and how the UI server is configured. Make the CORS origin configurable while preserving localhost support, then verify that the UI works across different local ports and that the expected CORS headers are present.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.