報錯信息如下:
Symfony\Component\Debug\Exception\FatalThrowableError thrown with message "Argument 2 passed to Symfony\Component\HttpFoundation\Request::
setTrustedProxies() must be of the type integer, array given, called in D:\phpStudy\Laravel5.5\vendor\fideloper\proxy\src\TrustProxies.php on line 54"
查閱文檔發(fā)現(xiàn)是由于Symfony HttpFoundation 的可信任代理功能發(fā)生了根本性的改變,需要調(diào)整中是間件。
打開 App\Http\Middleware\TrustProxies
將代碼:
protected $headers = [
Request::HEADER_FORWARDED => 'FORWARDED',
Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR',
Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST',
Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT',
Request::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO',
];
修改為:
protected $headers = Request::HEADER_X_FORWARDED_ALL;
再次測試正常。