Skip to content

Commit

Permalink
[fix]修复当域名带有端口时,REFERER验证失败的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongshaofa authored Sep 16, 2021
1 parent 6c5a542 commit 466d910
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/admin/middleware/CsrfMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function handle(Request $request, \Closure $next)
// 跨域校验
$refererUrl = $request->header('REFERER', null);
$refererInfo = parse_url($refererUrl);
$host = $request->host();
$host = $request->host(true);
if (!isset($refererInfo['host']) || $refererInfo['host'] != $host) {
$this->error('当前请求不合法!');
}
Expand All @@ -50,4 +50,4 @@ public function handle(Request $request, \Closure $next)
}
return $next($request);
}
}
}

0 comments on commit 466d910

Please sign in to comment.