Compare commits

..

No commits in common. "e4364298729873f9f63aa6742269e5f6fd84073e" and "0cb5a56a6071ec570ad2f50d3b2ffab3eee7686d" have entirely different histories.

1 changed files with 1 additions and 5 deletions

View File

@ -13,13 +13,9 @@ export function createCors() {
if (opts.enabled) { if (opts.enabled) {
let origin = req.headers['origin'] || req.headers['referer'] || '' let origin = req.headers['origin'] || req.headers['referer'] || ''
let headers = req.headers['access-control-request-headers'] let headers = req.headers['access-control-request-headers']
if (!origin) {
return next()
}
let { hostname, host, protocol } = parse(origin) let { hostname, host, protocol } = parse(origin)
if (opts.origin.length) { if (opts.origin.length && hostname) {
let pass = false let pass = false
for (let it of opts.origin) { for (let it of opts.origin) {
if (hostname.endsWith(it)) { if (hostname.endsWith(it)) {