Compare commits
2 Commits
0cb5a56a60
...
e436429872
Author | SHA1 | Date |
---|---|---|
yutent | e436429872 | |
yutent | 79ff113b6f |
|
@ -13,9 +13,13 @@ export function createCors() {
|
|||
if (opts.enabled) {
|
||||
let origin = req.headers['origin'] || req.headers['referer'] || ''
|
||||
let headers = req.headers['access-control-request-headers']
|
||||
|
||||
if (!origin) {
|
||||
return next()
|
||||
}
|
||||
let { hostname, host, protocol } = parse(origin)
|
||||
|
||||
if (opts.origin.length && hostname) {
|
||||
if (opts.origin.length) {
|
||||
let pass = false
|
||||
for (let it of opts.origin) {
|
||||
if (hostname.endsWith(it)) {
|
||||
|
|
Loading…
Reference in New Issue