withRouting( web: __DIR__.'/../routes/web.php', commands: __DIR__.'/../routes/console.php', health: '/up', ) ->withMiddleware(function (Middleware $middleware) { $middleware->alias([ 'household' => EnsureHouseholdSelected::class, ]); // Behind a reverse proxy (nginx/Caddy) terminating TLS, Laravel only // sees the internal HTTP hop unless it trusts X-Forwarded-* headers — // otherwise every generated URL (including @vite asset URLs) comes // back as http:// and gets blocked as mixed content on an https:// page. $trustedProxies = env('TRUSTED_PROXIES', '*'); $middleware->trustProxies( at: $trustedProxies === '*' ? '*' : array_filter(explode(',', (string) $trustedProxies)), headers: Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO, ); }) ->withExceptions(function (Exceptions $exceptions) { // })->create();