Skip to content

Commit

Permalink
entrypoint: respect X-Real-IP header from reverse proxies
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixaill committed Jun 28, 2018
1 parent 15dedeb commit e766bb2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

0 comments on commit e766bb2

Please sign in to comment.