laravel / 10 / api / 10.x / illuminate / http / middleware / trustproxies.html

TrustProxies

class TrustProxies (View source)

Properties

protected array<int,string>|string|null $proxies

The trusted proxies for the application.

protected int $headers

The proxy header mappings.

Methods

mixed handle(Request $request, Closure $next)

Handle an incoming request.

void setTrustedProxyIpAddresses(Request $request)

Sets the trusted proxies on the request.

void setTrustedProxyIpAddressesToSpecificIps(Request $request, array $trustedIps)

Specify the IP addresses to trust explicitly.

void setTrustedProxyIpAddressesToTheCallingIp(Request $request)

Set the trusted proxy to be the IP address calling this servers.

int getTrustedHeaderNames()

Retrieve trusted header name(s), falling back to defaults if config not set.

array|string|null proxies()

Get the trusted proxies.

Details

mixed handle(Request $request, Closure $next)

Handle an incoming request.

Parameters

Request $request
Closure $next

Return Value

mixed

Exceptions

HttpException

protected void setTrustedProxyIpAddresses(Request $request)

Sets the trusted proxies on the request.

Parameters

Request $request

Return Value

void

protected void setTrustedProxyIpAddressesToSpecificIps(Request $request, array $trustedIps)

Specify the IP addresses to trust explicitly.

Parameters

Request $request
array $trustedIps

Return Value

void

protected void setTrustedProxyIpAddressesToTheCallingIp(Request $request)

Set the trusted proxy to be the IP address calling this servers.

Parameters

Request $request

Return Value

void

protected int getTrustedHeaderNames()

Retrieve trusted header name(s), falling back to defaults if config not set.

Return Value

int

A bit field of Request::HEADER_*, to set which headers to trust from your proxies.

protected array|string|null proxies()

Get the trusted proxies.

Return Value

array|string|null

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/10.x/Illuminate/Http/Middleware/TrustProxies.html