mirror of
https://github.com/appwrite/appwrite
synced 2026-05-06 06:48:22 +00:00
Updated origin check
This commit is contained in:
parent
89ba82755e
commit
8221cf6936
1 changed files with 5 additions and 3 deletions
|
|
@ -53,15 +53,17 @@ $clients = array_unique(array_merge($clientsConsole, array_map(function ($node)
|
|||
return false;
|
||||
}))));
|
||||
|
||||
$utopia->init(function () use ($utopia, $request, $response, &$user, $project, $roles, $webhook, $audit, $usage, $domain, $clients, $protocol) {
|
||||
$utopia->init(function () use ($utopia, $request, $response, &$user, $project, $roles, $webhook, $audit, $usage, $domain, $clients) {
|
||||
|
||||
$route = $utopia->match($request);
|
||||
|
||||
$referrer = $request->getServer('HTTP_REFERER', '');
|
||||
$origin = parse_url($request->getServer('HTTP_ORIGIN', $referrer), PHP_URL_HOST);
|
||||
$protocol = parse_url($request->getServer('HTTP_ORIGIN', $referrer), PHP_URL_SCHEME);
|
||||
$port = parse_url($request->getServer('HTTP_ORIGIN', $referrer), PHP_URL_PORT);
|
||||
|
||||
$refDomain = $protocol.'://'.((in_array($origin, $clients))
|
||||
? $origin : 'localhost');
|
||||
? $origin : 'localhost') . (!empty($port) ? ':'.$port : '');
|
||||
|
||||
/*
|
||||
* Security Headers
|
||||
|
|
@ -231,7 +233,7 @@ $utopia->shutdown(function () use ($response, $request, $webhook, $audit, $usage
|
|||
}
|
||||
});
|
||||
|
||||
$utopia->options(function () use ($request, $response, $domain, $project) {
|
||||
$utopia->options(function () use ($request, $response) {
|
||||
$origin = $request->getServer('HTTP_ORIGIN');
|
||||
|
||||
$response
|
||||
|
|
|
|||
Loading…
Reference in a new issue