taylornetwork/cloudflare-ip-laravel

dev-master 2019-05-17 22:54 UTC

This package is auto-updated.

Last update: 2024-05-18 09:54:15 UTC


README

If you use Cloudflare, this will set $_SERVER['REMOTE_ADDR'] to $_SERVER['HTTP_CF_CONNECTING_IP'] if it's set.

Install

Using Composer

$ composer require taylornetwork/cloudflare-ip-laravel

And then run

$ php artisan cf:install

Manually

You don't even need to install this package if you'd rather just edit your public/index.php yourself.

Just add the following after $app = require_once __DIR__.'/../bootstrap/app.php';

if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
    $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
}