Compare commits
No commits in common. "e4364298729873f9f63aa6742269e5f6fd84073e" and "0cb5a56a6071ec570ad2f50d3b2ffab3eee7686d" have entirely different histories.
e436429872
...
0cb5a56a60
|
@ -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)) {
|
||||||
|
|
Loading…
Reference in New Issue