mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
added loggings
This commit is contained in:
1 parent
fed8354c52
commit
2840561e2e
2 files changed
+29
No files matched your search
@@ -447,6 +447,24 @@ $http->on(Constant::EVENT_REQUEST, function (SwooleRequest $swooleRequest, Swool
|
||||
$request = new Request($swooleRequest);
|
||||
$response = new Response($swooleResponse);
|
||||
|
||||
// Debug incoming Origin header for HTTP requests
|
||||
$origin = $request->getOrigin();
|
||||
if ($origin !== '') {
|
||||
$originHost = \parse_url($origin, PHP_URL_HOST) ?: '';
|
||||
Console::warning(
|
||||
'[HTTP][Origin] Incoming origin: ' . $origin .
|
||||
' (originHost=' . $originHost .
|
||||
', requestHost=' . $request->getHostname() .
|
||||
', uri=' . $request->getURI() . ')'
|
||||
);
|
||||
} else {
|
||||
Console::warning(
|
||||
'[HTTP][Origin] No Origin header ' .
|
||||
'(requestHost=' . $request->getHostname() .
|
||||
', uri=' . $request->getURI() . ')'
|
||||
);
|
||||
}
|
||||
|
||||
if (Files::isFileLoaded($request->getURI())) {
|
||||
$time = (60 * 60 * 24 * 365 * 2); // 45 days cache
|
||||
|
||||
|
||||
@@ -607,9 +607,20 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server,
|
||||
* Skip this check for non-web platforms which are not required to send an origin header.
|
||||
*/
|
||||
$origin = $request->getOrigin();
|
||||
$originHost = \parse_url($origin, PHP_URL_HOST) ?: '';
|
||||
Console::warning(
|
||||
'[Realtime][Origin] Incoming origin: ' . $origin .
|
||||
' (originHost=' . $originHost .
|
||||
', requestHost=' . $request->getHostname() .
|
||||
', projectId=' . $project->getId() . ')'
|
||||
);
|
||||
$originValidator = $app->getResource('originValidator');
|
||||
|
||||
if (!empty($origin) && !$originValidator->isValid($origin) && $project->getId() !== 'console') {
|
||||
Console::warning(
|
||||
'[Realtime][Origin] Origin failed validation: ' . $origin .
|
||||
' | reason="' . $originValidator->getDescription() . '"'
|
||||
);
|
||||
throw new Exception(Exception::REALTIME_POLICY_VIOLATION, $originValidator->getDescription());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user