参数2传递给symfony\component\httpfoundation\request::settrustedproxies

11dmarpk  于 2021-10-10  发布在  Java
关注(0)|答案(0)|浏览(309)

我刚刚克隆了laravel 8/vue js项目,我正在尝试运行它,我遇到了这个错误

Argument 2 passed to Symfony\Component\HttpFoundation\Request::setTrustedProxies() must be of the type int, array given, called in C:\lab\vue-laravel-crud-2\vue-laravel-crud\vendor\fideloper\proxy\src\TrustProxies.php on line 54

我在谷歌上搜索了这个错误,并将其添加到我的代码中,但它不起作用。代码是怎样的

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;

我已经用这个代码替换了它

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',
    ];

但是错误仍然存在,有没有人知道这个错误,因为我在谷歌上搜索了很多次,什么也没找到。提前谢谢。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题