koajs / koajs/cors

How to set multiple domains ?

Open
#75 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
742
Forks
83
PR merge metrics
No merged PRs in 30d

Description

I tried

```javascript
app.use(cors({
origin: function (ctx) {
if (['https://www.example1.com', 'https://www.example2.com'].includes(ctx.get('Origin'))) {
return ctx.get('Origin');
}
return null;
}
}));
```

But it doesn't work, any solution ?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the JavaScript CORS middleware configuration shown in the issue and inspect the repository's middleware entry point and usage documentation. Confirm how the origin callback handles the two listed domains and identify what must change for both origins to be accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.