matomo-org/matomo

IP::getNonProxyIpFromHeader retrieves final proxy instead of client

オープン

#7,060 opened on 2015/01/21

 (8 件のコメント) (0 件のリアクション) (0 人の担当者)PHP (2,890 件のフォーク)batch import
BugHelp wanted

Repository metrics

Stars
 (21,789 個のスター)
PR merge metrics
 (平均マージ 8d 11h) (30d で 106 merged PRs)

説明

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.

コントリビューターガイド