CheckForTrustedProxies
Enables support for trusted proxies in requests.
class Winter\Storm\Foundation\Http\Middleware\CheckForTrustedProxies
Allows for trusted proxies to provide secure assets in a request even if PHP itself is declaring that HTTPS is inactive, which is the case for a lot of common DNS, caching and load balancing providers such as Amazon Elastic Load Balancing, CloudFlare, etc.
Proxies should be defined in the config/app.php
file within the trustedProxies
configuration variable.
Based off the implementation from https://github.com/fideloper/TrustedProxy.
Properties
protected $app : Illuminate\Contracts\Foundation\Application
The application instance.
Methods
public __construct (Illuminate\Contracts\Foundation\Application $app) : void
Create a new middleware instance.
Property | Type | Description |
---|---|---|
$app | Illuminate\Contracts\Foundation\Application |
Illuminate\Contracts\Foundation\Application
|
public handle (Illuminate\Http\Request $request, Closure $next) : mixed
Handle an incoming request.
Property | Type | Description |
---|---|---|
$request | Illuminate\Http\Request |
Illuminate\Http\Request
|
$next | Closure |
Closure
|
public headers () : int
Get proxy headers to trust.
public proxies () : array | string | false | null
Get proxies defined in configuration.
protected allowProxies (Illuminate\Http\Request $request, array $proxies) : void
Allows the given IP addresses to be trusted as proxies.
Property | Type | Description |
---|---|---|
$request | Illuminate\Http\Request |
Illuminate\Http\Request
|
$proxies | array |
array
|
protected getTrustedHeaders () : int
Retrieve trusted headers, falling back to trusting no headers, effectively disallowing all proxies.
A bit field of Request::HEADER_*, to set which headers to trust from your proxies.
protected setTrustedProxies (Illuminate\Http\Request $request) : void
Sets the trusted proxies for the request based on the app.trustedProxies
configuration option.
Property | Type | Description |
---|---|---|
$request | Illuminate\Http\Request |
Illuminate\Http\Request
|