From e766bb2f5553a142219022abe3d3407dcb0f2413 Mon Sep 17 00:00:00 2001 From: Mikhail Paulyshka Date: Thu, 28 Jun 2018 23:53:58 +0300 Subject: [PATCH] entrypoint: respect X-Real-IP header from reverse proxies --- index.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.php b/index.php index e17b87d..d33d7a6 100644 --- a/index.php +++ b/index.php @@ -13,5 +13,11 @@ defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3); } +// respect X-Real-IP header from reverse proxy +if(isset($_SERVER['HTTP_X_REAL_IP'])) +{ + $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_REAL_IP']; +} + require_once($yii); Yii::createWebApplication($config)->run();