From 54a1594bb3744310333a8a8eb57ae5b5e1e5c656 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 27 Nov 2016 16:59:24 +0200 Subject: [PATCH] Merge CloudFlare IP fix --- bootstrap/app.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bootstrap/app.php b/bootstrap/app.php index 600e0fb5e9..1e44122c80 100755 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -65,4 +65,9 @@ $app->configureMonologUsing(function($monolog) { $monolog->pushHandler(new Monolog\Handler\StreamHandler(storage_path() . '/logs/laravel-error.log', Monolog\Logger::ERROR, false)); }); +// Capture real IP if using cloudflare +if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) { + $_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"]; +} + return $app;