Laravel 5.6 Trusted Proxies Error

 In Laravel
[include slug="includes/ad1"]

Recientemente actualicé un proyecto mío hasta Laravel 5.6 y encontré este error

Type error: Argument 2 passed to Symfony\Component\HttpFoundation\Request::setTrustedProxies() must be of the type integer, array given, called in /var/www/html/vendor/fideloper/proxy/src/TrustProxies.php on line 54

Para solucionarlo, deberá dirigirse a su middleware TrustedProxies.php y cambiar el código de ::

/**
* The current proxy header mappings.
*
* @var array
*/
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',
];

a ::

use Illuminate\Http\Request;

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

Como se indica en https://laravel.com/docs/5.6/upgrade “Trusted Proxies”

Recent Posts

Leave a Comment

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Not readable? Change text. captcha txt

Notice: Undefined index: quick_contact_gdpr_consent in /home/hcspmsoc/public_html/wp-content/themes/jupiter/views/footer/quick-contact.php on line 46

Notice: Undefined index: third_party_gdpr in /home/hcspmsoc/public_html/wp-content/themes/jupiter/framework/helpers/wp_footer.php on line 60