|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62243 Incorrect IP address when using reverse proxy
Submitted: 2012-06-06 14:47 UTC Modified: 2013-02-18 00:35 UTC
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:0 (0.0%)
From: wong at mollie dot nl Assigned: patrickallaert (profile)
Status: No Feedback Package: APM (PECL)
PHP Version: 5.3.13 OS: linux-debian-squeeze64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
14 + 38 = ?
Subscribe to this entry?

 [2012-06-06 14:47 UTC] wong at mollie dot nl
The stored Remote IP address in the `event`.`ip` column is incorrect, if Apache 
is running behind a reverse proxy like nginx. 

The value should equal the $_SERVER['REMOTE_ADDR'] value in long-format.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-07 07:06 UTC] wong at mollie dot nl
This is more of a bug since PHP does get it right, where APM does not.
 [2012-06-07 07:06 UTC] wong at mollie dot nl
-Type: Feature/Change Request +Type: Bug
 [2012-06-18 21:28 UTC]
-Assigned To: +Assigned To: patrickallaert
 [2012-06-18 22:28 UTC]
It is very unlikely that $_SERVER['REMOTE_ADDR'] contains the IP address of the 
client when behind a proxy (without specific manipulation in userland or with 
the help of an extension).

Normally, in such case one should inspect $_SERVER['HTTP_X_FORWARD_FOR'].

In all cases, APM actually stores the content of $_SERVER['REMOTE_ADDR'].

What I can do is inspecting $_SERVER['HTTP_X_FORWARD_FOR'] first and use this 
one if filled.

Does this suggestion suites your needs?
 [2012-06-18 22:29 UTC]
-Status: Assigned +Status: Feedback
 [2013-02-18 00:35 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Oct 18 21:03:39 2021 UTC