Laravel Requests: Configuring Trusted Proxies

<?php

namespace App\Http\Middleware;

use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;

class TrustProxies extends Middleware
{
    /**
     * The trusted proxies for this application.
     *
     * @var array
     */
    protected $proxies = [
        '192.168.1.1',
        '192.168.1.2',
    ];

    /**
     * The headers that should be used to detect proxies.
     *
     * @var string
     */
    protected $headers = Request::HEADER_X_FORWARDED_ALL;
}

In addition to configuring the trusted proxies, you may configure the proxy $headers that should be trusted.

Trusting All Proxies

/**
 * The trusted proxies for this application.
 *
 * @var array
 */
protected $proxies = '*';

you may use * to trust all proxies.

Related concepts

Laravel Requests: Configuring Trusted Proxies — Structure map

Clickable & Draggable!

Laravel Requests: Configuring Trusted Proxies — Related pages: