Skip to content

Commit

Permalink
Add trustHosts() documentation when hosts are fetched from configurat…
Browse files Browse the repository at this point in the history
…ion file

Document the fix from laravel/framework#50877, triggered by issue laravel/framework#50845
  • Loading branch information
amaralis authored Aug 15, 2024
1 parent d8ab24c commit 75be0cd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -649,3 +649,9 @@ By default, requests coming from subdomains of the application's URL are also au
->withMiddleware(function (Middleware $middleware) {
$middleware->trustHosts(at: ['laravel.test'], subdomains: false);
})

If you wish to fetch your trusted hosts from the application's configured values, these must be fetched using a callable. Assuming there is an `allowed_hosts` key in your application's `config/app.php` file:

->withMiddleware(function (Middleware $middleware) {
$middleware->trustHosts(at: fn () => config('app.allowed_hosts'));
})

0 comments on commit 75be0cd

Please sign in to comment.