Skip to content

Commit

Permalink
Update trustHosts() documentation to reflect fix (#9822)
Browse files Browse the repository at this point in the history
* Add trustHosts() documentation when hosts are fetched from configuration file

Document the fix from laravel/framework#50877, triggered by issue laravel/framework#50845

* Update requests.md

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
amaralis and taylorotwell authored Aug 15, 2024
1 parent 527e6a3 commit cd97d3e
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 need to access your application's configuration files or database to determine your trusted hosts, you may provide a closure to the `at` argument:

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

0 comments on commit cd97d3e

Please sign in to comment.