The colleague with the answer above is, in principle, right. Only he forgot to mention that after all the changes in the file, you need to delete the package fideloper/proxy:
https://laravel.com/docs/9.x/upgrade
Trusted Proxies
Likelihood Of Impact: Low
If you are upgrading your Laravel 8 project to Laravel 9 by importing your existing application code into a totally new Laravel 9 application skeleton, you may need to update your application’s “trusted proxy” middleware.
Within your
app/Http/Middleware/TrustProxies.phpfile, updateuse Fideloper\Proxy\TrustProxies as Middlewaretouse Illuminate\Http\Middleware\TrustProxies as Middleware.Next, within
app/Http/Middleware/TrustProxies.php, you should update the$headersproperty definition:// Before... protected $headers = Request::HEADER_X_FORWARDED_ALL; // After... protected $headers = Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_AWS_ELB;Finally, you can remove the
fideloper/proxyComposer dependency from your application:
composer remove fideloper/proxy