Permalink
Browse files

Add support for X-Real-Ip header (from nginx)

Some nginx proxy_pass configurations have the remote address set to the HTTP_X_REAL_IP header. See http://wiki.nginx.org/HttpProxyModule for details.
  • Loading branch information...
1 parent 96bb832 commit 26beca784162143803eefc120d76dc1658dfaad0 @ericcholis committed Nov 12, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 action/Request.php
View
@@ -246,7 +246,7 @@ public function env($key) {
$this->_env[$key] = $val;
if ($key == 'REMOTE_ADDR') {
- foreach (array('HTTP_X_FORWARDED_FOR', 'HTTP_PC_REMOTE_ADDR') as $altKey) {
+ foreach (array('HTTP_X_FORWARDED_FOR', 'HTTP_PC_REMOTE_ADDR', 'HTTP_X_REAL_IP') as $altKey) {
if ($addr = $this->env($altKey)) {
$val = $addr;
break;

0 comments on commit 26beca7

Please sign in to comment.