As stated in the upgrade guide, you need to set the $headers property in App\Http\Middleware\TrustProxies to a bit property.
The constants are defined in Symfony\Component\HttpFoundation\Request.
const HEADER_FORWARDED = 0b00001; // When using RFC 7239 const HEADER_X_FORWARDED_FOR = 0b00010; const HEADER_X_FORWARDED_HOST = 0b00100; const HEADER_X_FORWARDED_PROTO = 0b01000; const HEADER_X_FORWARDED_PORT = 0b10000; const HEADER_X_FORWARDED_ALL = 0b11110; // All "X-Forwarded-*" headers const HEADER_X_FORWARDED_AWS_ELB = 0b11010; // AWS ELB doesn't send X-Forwarded-Host
In the upgrade guide, HEADER_X_FORWARDED_ALL is used but you can use a combination of the bit values.
Due to underlying changes in the trusted proxy functionality of Symfony HttpFoundation, slight changes must be made to your application's App\Http\Middleware\TrustProxies middleware.
The $headers property, which was previously an array, is now a bit property that accepts several different values. For example, to trust all forwarded headers, you may update your $headers property to the following value:
use Illuminate\Http\Request;/** * The headers that should be used to detect proxies. * * @var int */protected $headers = Request::HEADER_X_FORWARDED_ALL;//需要更改的就是此处
For more information on the available $headers values, check out the full documentation on trusting proxies.
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