update 20.10.2025
This commit is contained in:
parent
8c11130b5d
commit
a939cd51ef
616 changed files with 84821 additions and 4121 deletions
69
dev/routes-optimization/SessionDebugger.php
Normal file
69
dev/routes-optimization/SessionDebugger.php
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Debuggt Session-Änderungen direkt nach StartSession.
|
||||
*
|
||||
* Diese Middleware läuft direkt nach Illuminate\Session\Middleware\StartSession
|
||||
* und überprüft, ob die Session-ID sich geändert hat.
|
||||
*/
|
||||
class SessionDebugger
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
// Session-ID nach StartSession überprüfen
|
||||
$currentSessionId = Session::getId();
|
||||
|
||||
if (config('app.debug')) {
|
||||
\Log::channel('domain')->debug('SessionDebugger: Direkt nach StartSession', [
|
||||
'session_id_after_start_session' => $currentSessionId,
|
||||
'session_started' => Session::isStarted(),
|
||||
'session_domain' => config('session.domain'),
|
||||
'request_host' => $request->getHost(),
|
||||
'middleware_position' => 'Nach StartSession, vor AuthSessionDebugger',
|
||||
'session_all_keys' => array_keys(Session::all())
|
||||
]);
|
||||
}
|
||||
|
||||
// Vergleiche mit der DomainResolver Session-ID (wenn verfügbar)
|
||||
$domainResolverSessionId = $request->attributes->get('domain_resolver_session_id');
|
||||
if ($domainResolverSessionId && config('app.debug')) {
|
||||
if ($domainResolverSessionId !== $currentSessionId) {
|
||||
\Log::channel('domain')->warning('🚨 SessionDebugger: Session-ID unterscheidet sich von DomainResolver!', [
|
||||
'domain_resolver_session_id' => $domainResolverSessionId,
|
||||
'current_session_id' => $currentSessionId,
|
||||
'session_regenerated_by' => 'StartSession - Domain-Konfiguration war falsch!',
|
||||
'request_host' => $request->getHost(),
|
||||
'session_domain' => config('session.domain'),
|
||||
'solution' => 'DomainResolver setzt jetzt korrekte Session-Domain vor StartSession'
|
||||
]);
|
||||
} else {
|
||||
\Log::channel('domain')->info('✅ SessionDebugger: Session-ID konsistent mit DomainResolver', [
|
||||
'session_id' => $currentSessionId,
|
||||
'request_host' => $request->getHost(),
|
||||
'session_domain' => config('session.domain'),
|
||||
'status' => 'Session-Domain wurde korrekt vor StartSession gesetzt'
|
||||
]);
|
||||
}
|
||||
} elseif (config('app.debug')) {
|
||||
\Log::channel('domain')->debug('SessionDebugger: Keine DomainResolver Session-ID zum Vergleich verfügbar', [
|
||||
'current_session_id' => $currentSessionId,
|
||||
'request_host' => $request->getHost(),
|
||||
'session_domain' => config('session.domain')
|
||||
]);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue