private function canProxy() {
        // grab the comma-delimited set of trusted proxies if they exist
        $trustedProxies = config('proxypass.trusted_proxies');
        if(empty($trustedProxies)) {
            // no proxies have been whitelisted so allow all proxy servers
            return true;
        }

        // form an array and kill any whitespace in each element
        $proxyArr = explode(",", $trustedProxies);
        array_walk($proxyArr, 'trim');

        // first we need to check the REMOTE_ADDR value to see if the IP
        // address being reported matches one of the trusted proxies
        if(!empty($_SERVER['REMOTE_ADDR'])) {
            if(in_array($_SERVER['REMOTE_ADDR'], $proxyArr)) {
                // the machine that made the request is a trusted proxy so
                // everything is fine
                return true;
            }
        }

        // now we need to check the X-Forwarded-Server header if it exists
        // since that's one of the three standard request headers that a
        // proxy would pass along with a request
        if(!empty($_SERVER['HTTP_X_FORWARDED_SERVER'])) {
            if(in_array(trim($_SERVER['HTTP_X_FORWARDED_SERVER']), $proxyArr)) {
                // the hostname of the proxy matches a trusted proxy so
                // everything is fine
                return true;
            }
        }

        // we are either not behind a proxy or the proxy forwarding the request
        // is not in the set of trusted proxies
        return false;
    }
private function canProxy() {
        // grab the comma-delimited set of trusted proxies if they exist
        $trustedProxies = config('proxypass.trusted_proxies');
        if(empty($trustedProxies)) {
            // no proxies have been whitelisted so allow all proxy servers
            return true;
        }

        // form an array and kill any whitespace in each element
        $proxyArr = explode(",", $trustedProxies);
        array_walk($proxyArr, 'trim');

        // first we need to check the REMOTE_ADDR value to see if the IP
        // address being reported matches one of the trusted proxies
        if(!empty($_SERVER['REMOTE_ADDR'])) {
            if(in_array($_SERVER['REMOTE_ADDR'], $proxyArr)) {
                // the machine that made the request is a trusted proxy so
                // everything is fine
                return true;
            }
        }

        // now we need to check the X-Forwarded-Server header if it exists
        // since that's one of the three standard request headers that a
        // proxy would pass along with a request
        if(!empty($_SERVER['HTTP_X_FORWARDED_SERVER'])) {
            if(in_array(trim($_SERVER['HTTP_X_FORWARDED_SERVER']), $proxyArr)) {
                // the hostname of the proxy matches a trusted proxy so
                // everything is fine
                return true;
            }
        }

        // we are either not behind a proxy or the proxy forwarding the request
        // is not in the set of trusted proxies
        return false;
    }
private function canProxy ( ) { // grab the comma-delimited set of trusted proxies if they exist $ trustedProxies = config ( 'proxypass.trusted_proxies' ) ; if ( empty ( $ trustedProxies ) ) { // no proxies have been whitelisted so allow all proxy servers return true ; } // form an array and kill any whitespace in each element $ proxyArr = explode ( "," , $ trustedProxies ) ; array_walk ( $ proxyArr , 'trim' ) ; // first we need to check the REMOTE_ADDR value to see if the IP // address being reported matches one of the trusted proxies if ( ! empty ( $ _SERVER [ 'REMOTE_ADDR' ] ) ) { if ( in_array ( $ _SERVER [ 'REMOTE_ADDR' ] , $ proxyArr ) ) { // the machine that made the request is a trusted proxy so // everything is fine return true ; } } // now we need to check the X-Forwarded-Server header if it exists // since that's one of the three standard request headers that a // proxy would pass along with a request if ( ! empty ( $ _SERVER [ 'HTTP_X_FORWARDED_SERVER' ] ) ) { if ( in_array ( trim ( $ _SERVER [ 'HTTP_X_FORWARDED_SERVER' ] ) , $ proxyArr ) ) { // the hostname of the proxy matches a trusted proxy so // everything is fine return true ; } } // we are either not behind a proxy or the proxy forwarding the request // is not in the set of trusted proxies return false ; }
Returns whether the proxy server is allowed to perform proxy operations
and affect how the URLs are generated.

@return bool
Returns whether the proxy server is allowed to perform proxy operations and affect how the URLs are generated .