Skip to content

Commit 9ee1fd0

Browse files
committed
feat: move trusted hosts to config
1 parent 089666c commit 9ee1fd0

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

bootstrap/app.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,7 @@
2828
Request::HEADER_X_FORWARDED_AWS_ELB
2929
);
3030
$middleware->statefulApi();
31-
$middleware->trustHosts(at: [
32-
'^localhost(:[0-9]+)?$',
33-
'^127\.0\.0\.1(:[0-9]+)?$',
34-
'^app\.test(:[0-9]+)?$',
35-
env('APP_HOST', 'app.test'),
36-
]);
31+
$middleware->trustHosts(at: fn() => config('app.trusted_hosts'));
3732
$middleware->web(append: [
3833
\App\Http\Middleware\UserLastActive::class,
3934
]);

config/app.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,12 @@
169169
])->toArray(),
170170

171171
'login_message' => env('LOGIN_MESSAGE', 'Enter your email and password below to log in'),
172+
173+
'trusted_hosts' => [
174+
'^localhost(:[0-9]+)?$',
175+
'^127\.0\.0\.1(:[0-9]+)?$',
176+
'^app\.test(:[0-9]+)?$',
177+
env('APP_HOST', 'app.test'),
178+
...explode(',', env('SANCTUM_STATEFUL_DOMAINS', '192.168.1.1,127.0.0.1'))
179+
]
172180
];

0 commit comments

Comments
 (0)