egg-cors本地开发体验增强-不需要设置端口
Open
Inactive
- Dominant language
- TypeScript
- Stars
- 19k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
如果线上的safedomain 是 xxx.xx.com 本地开发的时候一般是 xxx.xx.com:7001, 这样会需要在domainwhitelist里面配一个带端口的地址。
我们本地开发的时候,是不是可以默认做端口忽略? 比如
```
cors: {origin: function judgeWithoutPort(ctx) {
const origin = ctx.get('Origin');
const hostname = url.parse(origin).hostname;
if (ctx.isSafeDomain(hostname)) {
return origin;
}
return '';
}
```
Contributor guide
Assessment
This issue has not been assessed yet.