fix: forcer HTTPS pour eviter mixed content en prod
Derriere reverse proxy, Laravel voyait les requetes en http et generait des URLs d'assets http:// sur une page https:// (bloque par le navigateur). Trust des headers X-Forwarded-* + forceScheme quand APP_URL est en https.
This commit is contained in:
+8
-1
@@ -4,6 +4,7 @@ use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Configuration\Exceptions;
|
||||
use Illuminate\Foundation\Configuration\Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
|
||||
|
||||
return Application::configure(basePath: dirname(__DIR__))
|
||||
->withRouting(
|
||||
@@ -17,7 +18,13 @@ return Application::configure(basePath: dirname(__DIR__))
|
||||
\Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets::class,
|
||||
]);
|
||||
|
||||
//
|
||||
$middleware->trustProxies(
|
||||
at: '*',
|
||||
headers: SymfonyRequest::HEADER_X_FORWARDED_FOR
|
||||
| SymfonyRequest::HEADER_X_FORWARDED_HOST
|
||||
| SymfonyRequest::HEADER_X_FORWARDED_PORT
|
||||
| SymfonyRequest::HEADER_X_FORWARDED_PROTO,
|
||||
);
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions): void {
|
||||
$exceptions->shouldRenderJsonWhen(
|
||||
|
||||
Reference in New Issue
Block a user