Framework: [Laravel 5.6] Upgrade problem from 5.5 Argument 2 passed to Symfony\Component\HttpFoundation\Request::setTrustedProxies() must be of the type integer, array given, called in /home/sergi/Code/lanparty/vendor/fideloper/proxy/src/TrustProxies.php on line 54

Created on 7 Feb 2018  路  7Comments  路  Source: laravel/framework

  • Laravel Version: 5.6
  • PHP Version: 7.1.3
  • Database Driver & Version: ---

Description:

Error:
Argument 2 passed to Symfony\Component\HttpFoundation\Request::setTrustedProxies() must be of the type integer, array given, called in /home/sergi/Code/lanparty/vendor/fideloper/proxy/src/TrustProxies.php on line 54

Steps To Reproduce:

  • Upgrade app from 5.5 to 5.6

Most helpful comment

For anyone else arriving here, the solution is to change the array on line 22 of App/Http/Middleware/TrustedProxies from an array, to a constant:

protected $headers = Request::HEADER_X_FORWARDED_ALL;

Ref: StackOverflow

All 7 comments

Ok solved reading Upgrade Guide (sorry guys).

Please if you have also this issue see Trusted proxies section at:

https://laravel.com/docs/5.6/upgrade

Hi, what was the exact library to upgrade to avoid this error? I dont use some of the librabries mention so I only changed "laravel/framework": "5.6.*", "fideloper/proxy": "~4.0", "phpunit/phpunit": "~7.0".

I still get the error in post.

For anyone else arriving here, the solution is to change the array on line 22 of App/Http/Middleware/TrustedProxies from an array, to a constant:

protected $headers = Request::HEADER_X_FORWARDED_ALL;

Ref: StackOverflow

This change to the TrustProxies middleware is specifically stated in the upgrade guide.

I see that now. It wasn鈥檛 obvious in my particular case because the upgrade occurred by composer update. It wasn鈥檛 until I got the error and found this thread that I realized Laravel had upgraded, and the StackOverflow post ranks higher in search for the error than the upgrade guide.

I just fix this problem with @acacha suggested section Trusted Proxies fix. But i rlly didnt understand what i did.
:D Anyone, explain me what the fuck i just touch? what is the Trusted Proxies file

I just fix this problem with @acacha suggested section _Trusted Proxies_ fix. But i rlly didnt understand what i did.
:D Anyone, explain me what the fuck i just touch? what is the Trusted Proxies file

hahahaaaa.. that also solved my problem. hoping someone can at least guide us on the docs.

Was this page helpful?
0 / 5 - 0 ratings