Page MenuHomeDevCentral

Get remote address

Authored by dereckson on Apr 20 2018, 20:09.



Provide a Request::getRemoteAddress() to use instead of
$_SERVER['REMOTE_ADDR'] to be proxy compliant.


The web server is trusted to clean headers and only forward to
the PHP processes the whitelisted headers, with validated values
or with values determines by the server.

This plays very well with scenarii like nginx front-end, nginx back-end
and php-fpm.

Ref T1395

Test Plan

Unit tests are provided, from rKGF

Diff Detail

rKOT Keruald OmniTools
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

dereckson requested review of this revision.Apr 20 2018, 20:09
dereckson created this revision.
dereckson updated this revision to Diff 4144.Apr 20 2018, 20:10

Add declare(strict_types=1);

dereckson accepted this revision.Apr 20 2018, 20:21
This revision is now accepted and ready to land.Apr 20 2018, 20:21
dereckson updated this revision to Diff 4145.Apr 21 2018, 00:47

Improve comments format.

dereckson accepted this revision.Apr 21 2018, 00:56
This revision was automatically updated to reflect the committed changes.