Skip to content

Commit 7395bfd

Browse files
committed
fix(status): Avoid session creation for status requests
Signed-off-by: Git'Fellow <[email protected]>
1 parent 3822db5 commit 7395bfd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/base.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,13 @@ private static function printUpgradePage(\OC\SystemConfig $systemConfig): void {
363363
public static function initSession(): void {
364364
$request = Server::get(IRequest::class);
365365

366+
// Do not initialize sessions for 'status.php' requests
367+
// Monitoring endpoints can quickly flood session handlers
368+
// and 'status.php' doesn't require sessions anyway
369+
if (str_ends_with($request->getRequestUri(), '/status.php')) {
370+
return;
371+
}
372+
366373
// TODO: Temporary disabled again to solve issues with CalDAV/CardDAV clients like DAVx5 that use cookies
367374
// TODO: See https://github.com/nextcloud/server/issues/37277#issuecomment-1476366147 and the other comments
368375
// TODO: for further information.
@@ -790,7 +797,7 @@ public static function init(): void {
790797
$isScssRequest = true;
791798
}
792799

793-
if (substr($request->getRequestUri(), -11) === '/status.php') {
800+
if (str_ends_with($request->getRequestUri(), '/status.php')) {
794801
http_response_code(400);
795802
header('Content-Type: application/json');
796803
echo '{"error": "Trusted domain error.", "code": 15}';

0 commit comments

Comments
 (0)