TrustHosts
class TrustHosts
Constants
| private REJECT_ALL_HOST_PATTERN |
|
Properties
| protected Application | $app | The application instance. |
|
| static protected null|array<int, string>|Closure(): array<int, string> | $alwaysTrust | The trusted hosts that have been configured to always be trusted. |
|
| static protected null|Request): array<int, string> | $hostsResolver | The closure used to resolve trusted hosts for the current request. |
|
| static protected bool|null | $subdomains | Indicates whether subdomains of the application URL should be trusted. |
Methods
Get the host patterns that should be trusted.
Register a closure that resolves trusted hosts for the current request.
Determine if the application should specify trusted hosts.
Get a regular expression matching the application URL and all of its subdomains.
Flush all static state.
Details
at line 44
__construct(Application $app)
Create a new middleware instance.
at line 52
array
hosts()
Get the host patterns that should be trusted.
at line 87
protected array
resolveTrustedHostPatterns(Request $request)
Get the trusted host patterns for the current request.
at line 110
static void
at(array|Closure $hosts, bool $subdomains = true)
Specify the hosts that should always be trusted.
Boot-only. The list persists in static properties for the worker lifetime and applies to every subsequent request.
at line 124
static void
resolveHostsUsing(Closure|null $callback)
Register a closure that resolves trusted hosts for the current request.
Boot-only. The callback persists in static state for the worker lifetime and fully replaces the static trusted host list for every subsequent request.
at line 132
protected bool
shouldSpecifyTrustedHosts()
Determine if the application should specify trusted hosts.
at line 141
protected string|null
allSubdomainsOfApplicationUrl()
Get a regular expression matching the application URL and all of its subdomains.
at line 153
static void
flushState()
Flush all static state.