Client-Error-Endpoint POST /api/vitec/client-error (0072-FE / 0077-BE)

Neue PSR-15-Middleware ClientErrorMiddleware: nimmt Browser-Fehler des
React-Frontends als JSON {url, message, stack, release, userAgent}
entgegen und antwortet 204 ohne Body. Schutz: 30 Meldungen pro Minute
und IP (Sliding Window ueber TYPO3-RateLimiter, 429 + Retry-After),
8-KB-Body-Limit (413, Content-Length und tatsaechliche Bytes), kein
JSON-Objekt oder leere message = 400, GET = 405. Keine Session, keine
Cookies; der /_json-Praefix funktioniert ebenfalls.

Speicherung in der neuen Tabelle tx_vitec_clienterrorlog mit
anonymisierter IP (IPv4 letztes Oktett 0, IPv6 /48). Sichtbar als
Tabelle "Client errors (last 24 h)" im Modul VITEC SSR (mit Stack als
Aufklapper) und als Zeile "Client errors reported (24 h / 7 d)" in der
Dashboard-Kachel VITEC: SSR statistics.

CLI vitec:client-error-cleanup [--days=30] loescht Eintraege aelter als
30 Tage (taeglich per Cron).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
orascheandClaude Fable 5.1 committed 2026-11-10 17:25:23 +01:00
1 parent ff6f86b829
commit 5121eaa000
7 files changed
+360

No files matched your search

@@ -37,6 +37,11 @@ final class SsrStatsWidget implements WidgetInterface
$avgMs = $this->scalar('SELECT ROUND(AVG(response_ms)) FROM tx_vitec_ssrhealthlog WHERE crdate > ' . $d1 . ' AND ok = 1');
$maxCache = $this->scalar('SELECT MAX(cache_mb) FROM tx_vitec_ssrhealthlog WHERE crdate > ' . $d7);
// Browser-side errors reported via POST /api/vitec/client-error
// (ClientErrorMiddleware); details in the VITEC SSR module.
$clientErrors24h = $this->count('tx_vitec_clienterrorlog', 'crdate > ' . $d1);
$clientErrors7d = $this->count('tx_vitec_clienterrorlog', 'crdate > ' . $d7);
$rows = [
['Purges (24 h / 7 days)', $purges24h . ' / ' . $purges7d],
['of which full purges (7 d)', (string)$full7d],
@@ -47,6 +52,9 @@ final class SsrStatsWidget implements WidgetInterface
. ' <small>(' . $ok24h . '/' . $samples24h . ' samples)</small>'],
['Avg. response time (24 h)', $avgMs !== null ? $avgMs . ' ms' : '-'],
['Max. cache size (7 d)', $maxCache !== null ? $maxCache . ' MB' : '-'],
['Client errors reported (24 h / 7 d)', ($clientErrors24h > 0
? '<span class="badge badge-warning">' . $clientErrors24h . '</span>'
: '<span class="badge badge-success">0</span>') . ' / ' . $clientErrors7d],
];
$html = '<table class="table table-striped table-sm"><tbody>';