Skip to content

Commit a0df479

Browse files
committed
Add trustProxies middleware configuration in app.php
1 parent 1cff6a2 commit a0df479

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bootstrap/app.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use Illuminate\Foundation\Application;
44
use Illuminate\Foundation\Configuration\Exceptions;
55
use Illuminate\Foundation\Configuration\Middleware;
6+
use Symfony\Component\HttpFoundation\Request;
67

78
return Application::configure(basePath: dirname(__DIR__))
89
->withRouting(
@@ -11,7 +12,11 @@
1112
health: '/up',
1213
)
1314
->withMiddleware(function (Middleware $middleware) {
14-
//
15+
$middleware->trustProxies(at: '*', headers: Request::HEADER_X_FORWARDED_FOR |
16+
Request::HEADER_X_FORWARDED_HOST |
17+
Request::HEADER_X_FORWARDED_PORT |
18+
Request::HEADER_X_FORWARDED_PROTO |
19+
Request::HEADER_X_FORWARDED_AWS_ELB);
1520
})
1621
->withExceptions(function (Exceptions $exceptions) {
1722
//

0 commit comments

Comments
 (0)