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,796 个星标)
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.

贡献者指南