Compare commits

...

2 Commits

Author SHA1 Message Date
yutent e436429872 Merge branch 'master' of git.wkit.fun:gm5/core 2024-06-28 09:59:50 +08:00
yutent 79ff113b6f 优化跨域逻辑 2024-06-27 18:38:01 +08:00
1 changed files with 5 additions and 1 deletions

View File

@ -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)) {