Problem/Motivation
On systems where Drupal sits behind a reverse proxy you need to specify the proxy IP address (or addresses) in $conf['reverse_proxy_address']
in settings.php, so Drupal can exclude the proxy IPs when trying to return the clients IP address in the ip_address()
function.
It is possible to be in a situation where there may be many reverse proxies, or the reverse proxy address is assigned dynamically from a pool, which means you need to specify a large number of IPs in settings.php. For a /16 network range for the proxy, that adds 2.1MB to settings.php.
Drupal 8 solves this by using a symfony component that allows you to specify network ranges, but Drupal 7 does not have support for this. A workaround is to add $_SERVER['REMOTE_ADDR']
to the array of reverse proxies, but it would be nice to explicitly specify a whole network range.
Proposed resolution
Modify the ip_address()
function to also handle network ranges for $conf['reverse_proxy_address']
.
David Rothstein said he does in principle not oppose this change, as long as it is backwards compatible.
Remaining tasks
User interface changes
None.
API changes
None.