提交 bf32ff89 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

cannot use `*` if angular is set `.withCredentials = true`

上级 b36cdf25
......@@ -89,7 +89,11 @@ class Server extends EventEmitter {
const e = express()
e.use(bodyParser.json())
e.use(function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*')
// cannot use `*` if angular is set `.withCredentials = true`
// see also: https://github.com/whatwg/fetch/issues/251#issuecomment-199946808
// res.header('Access-Control-Allow-Origin', '*')
res.header('Access-Control-Allow-Origin', req.headers['origin'])
res.header('Access-Control-Allow-Credentials', 'true')
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
next()
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册