Laravel 5.4 new symfony update SetTrustedProxies () requires second parameter

I am using https

over descriptor middleware Cloudflare

, this is the code:

if(env('I_AM_BEHIND_CLOUDFLARE')) 
    $request->setTrustedProxies( [ $request->getClientIp() ] );
if (!$request->secure())
    return redirect()->secure($request->getRequestUri());
return $next($request);

      

this code worked until my last composer update

one which updated the symfony

component laravel

. it shows an exception from InvalidArgumentException

.

symfony

the last update changed a function setTrustedProxies()

that requires a second parameter as known headers.

Question: How do I set this second parameter?

+3


source to share


1 answer


You must pass the second argument from Request::HEADER_X_FORWARDED_ALL

either orRequest::HEADER_X_FORWARDED_FOR



Link: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Request.php#L575

+2


source







All Articles