diff --git a/app/modules/Inspector/Interfaces/Http/Handler/EventHandler.php b/app/modules/Inspector/Interfaces/Http/Handler/EventHandler.php index d82b7c3..5e71c4b 100644 --- a/app/modules/Inspector/Interfaces/Http/Handler/EventHandler.php +++ b/app/modules/Inspector/Interfaces/Http/Handler/EventHandler.php @@ -72,7 +72,10 @@ private function listenEvent(ServerRequestInterface $request): ?EventType if ( $request->hasHeader('X-Inspector-Key') || $request->hasHeader('X-Inspector-Version') - || \str_ends_with((string) $request->getUri(), 'inspector') + || ( + !\str_starts_with($request->getUri()->getPath(), '/inspector') + && \str_ends_with((string) $request->getUri(), 'inspector') + ) ) { return new EventType(type: 'inspector'); } diff --git a/app/src/Interfaces/Http/Handler/FrontendRequest.php b/app/src/Interfaces/Http/Handler/FrontendRequest.php index 3321e97..c78c609 100644 --- a/app/src/Interfaces/Http/Handler/FrontendRequest.php +++ b/app/src/Interfaces/Http/Handler/FrontendRequest.php @@ -36,6 +36,12 @@ public function handle(ServerRequestInterface $request, \Closure $next): Respons if ($path === '/') { $path = '/index.html'; + } elseif ( + !\str_starts_with($path, '/api') + && !\str_starts_with($path, '/assets') + && !\str_contains($path, '/src') + ) { + $path = '/index.html'; } $path = $this->publicPath . $path; @@ -71,6 +77,7 @@ private function isValidRequest(ServerRequestInterface $request): bool || \str_starts_with($path, '/src/') || \str_starts_with($path, '/assets/') || $path === '/favicon/favicon.ico' - || $path === '/bg.jpg'; + || $path === '/bg.jpg' + || !\str_starts_with($path, '/api'); } }