13
Class 'Fideloper\Proxy\TrustProxies' not found

enter image description here

Jithin Raj P R
  • 6,667
  • 8
  • 38
  • 69
Lupitha Yañez C.
  • 354
  • 1
  • 2
  • 7

3 Answers3

45
composer require fideloper/proxy
mazedlx
  • 1,405
  • 17
  • 24
5

If you faced the error after upgrading laravel 8 to 9 or 10 we don't need the Trustproxies package from the composer. You can simply remove by composer remove fideloper/proxy and update your packages by composer update command. it's properly mentioned in the laravel 9 upgrade guide. laravel.com/docs/9.x/upgrade#the-assert-deleted-method

Sujata Jadhav
  • 51
  • 1
  • 2
1

in Laravel v10, as @Sujata Jadhav wrote,
I remove fideloper/proxy
and in app/Http/Middleware/TrustProxies.php,
I changed :

use Fideloper\Proxy\TrustProxies as Middleware;
// […]
protected $headers = Request::HEADER_X_FORWARDED_ALL;

with

use Illuminate\Http\Middleware\TrustProxies as Middleware;
// […] 
protected $headers =
    Request::HEADER_X_FORWARDED_FOR |
    Request::HEADER_X_FORWARDED_HOST |
    Request::HEADER_X_FORWARDED_PORT |
    Request::HEADER_X_FORWARDED_PROTO; // I removed AWS_ELB line as I don't need it

as we can see at doc pages :

bcag2
  • 1,988
  • 1
  • 17
  • 31