matomo-org/matomo

IP::getNonProxyIpFromHeader retrieves final proxy instead of client

開放

#7,060 建立於 2015年1月21日

 (8 則留言) (0 個反應) (0 位負責人)PHP (2,890 個分叉)batch import
BugHelp wanted

倉庫指標

星標
 (21,771 顆星)
PR 合併指標
 (平均合併 8天 11小時) (30 天內合併 106 個 PR)

描述

IP::getNonProxyIpFromHeader attempts to retrieve the client IP address from headers configured in proxy_client_headers[]. This calls IP::getLastIpFromList, excluding proxies configured via proxy_ips[].

What I do not understand is why by default this returns the last IP, whereas the format for X-Forwarded-For is client, proxy1, proxy2, ...: http://en.wikipedia.org/wiki/X-Forwarded-For#Format

This only becomes an issue when running Piwik behind multiple proxies; for example the configuration in question is:

[Enterprise Appliance] => [IIS ARR] => [Piwik]

So Piwik sees:

X-Forwarded-For: <client>, <enterprise_appliance>

Basically the current behavior would seem to select the IP of the last proxy by default. This would be problematic in a scenario with variable proxy IPs.

貢獻者指南