withRouting( web: __DIR__.'/../routes/web.php', api: __DIR__.'/../routes/api.php', commands: __DIR__.'/../routes/console.php', health: '/up', ) ->withMiddleware(function (Middleware $middleware): void { // Behind a reverse proxy (nginx serves plain HTTP on :8001; TLS is // terminated in front of it), so trust X-Forwarded-* headers — // otherwise Laravel/Livewire generate http:// URLs even when the // original request was https, tripping mixed-content blocking. $middleware->trustProxies(at: '*'); }) ->withExceptions(function (Exceptions $exceptions): void { $exceptions->shouldRenderJsonWhen( fn (Request $request) => $request->is('api/*'), ); })->create();