Looking to hire Laravel developers? Try LaraJobs
This package is not available.

cloudflare-ip-laravel maintained by taylornetwork

Author
Last update
2019/05/18 00:54 (dev-master)
License
Links
Downloads
54

Comments
comments powered by Disqus

Cloudflare IP Laravel

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