mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
fix(sentinel): send Retry-After for unreachable servers and invalid tokens
- Send Retry-After: 300 when the server is not functional - Send Retry-After: 3600 when the push token cannot be decrypted Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e7e952fcad
commit
0e01f2149c
@@ -39,7 +39,8 @@ class SentinelController extends Controller
|
||||
} catch (Exception $e) {
|
||||
auditLogWebhookFailure('sentinel', 'decrypt_failed');
|
||||
|
||||
return response()->json(['message' => 'Invalid token'], 401);
|
||||
// Usually a Sentinel of another instance or of an old APP_KEY: it cannot recover, so it waits one hour.
|
||||
return response()->json(['message' => 'Invalid token'], 401, ['Retry-After' => 3600]);
|
||||
}
|
||||
$server_uuid = data_get($decrypted_token, 'server_uuid');
|
||||
if (! $server_uuid) {
|
||||
@@ -78,7 +79,8 @@ class SentinelController extends Controller
|
||||
]);
|
||||
$server->rememberSentinelPushProblem('Coolify rejected the push: the server is marked unreachable, not usable, or disabled. Validate the server connection.');
|
||||
|
||||
return response()->json(['message' => 'Server is not functional'], 401);
|
||||
// SSH checks mark the server reachable again, so pushes can wait 5 minutes.
|
||||
return response()->json(['message' => 'Server is not functional'], 401, ['Retry-After' => 300]);
|
||||
}
|
||||
|
||||
if ($server->settings->sentinel_token !== $naked_token) {
|
||||
|
||||
Reference in New Issue
Block a user