1 頁 (共 1 頁)

5.5 upgrad 5.8

發表於 : 2019-06-13 08:05:37
yehlu
yehlu@x1c-yehlu:~/Sites/maapi$ php artisan

In trustedproxy.php line 66:

Undefined class constant 'HEADER_CLIENT_IP'

https://stackoverflow.com/questions/485 ... -5-6-error

代碼: 選擇全部


I did this and it works perfectly.

1. composer.json:

From:

"require": {
        "php": ">=7.0.0",
        "fideloper/proxy": "~3.3",
        "laravel/framework": "5.5.*",
        "laravel/tinker": "~1.0"
    },
To:

"require": {
        "php": ">=7.1.3",
        "fideloper/proxy": "~4.0",
        "laravel/framework": "5.6.*",
        "laravel/tinker": "~1.0"
    },
2. Replace app\Http\Middleware\TrustedProxies.php file with contents below:

<?php

namespace App\Http\Middleware;

use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;

class TrustProxies extends Middleware
{
    /**
     * The trusted proxies for this application.
     *
     * @var array
     */
    protected $proxies;

    /**
     * The headers that should be used to detect proxies.
     *
     * @var string
     */
    protected $headers = Request::HEADER_X_FORWARDED_ALL;
}
3. composer update