We advise writing to $_SERVER in the preamble, but end up overwriting settings in PhabricatorStartup. We should find a way to let users set REMOTE_ADDR and HTTPS without having them overwritten.
Description
Description
Revisions and Commits
Revisions and Commits
rP Phabricator | |||
D12977 Preamble fix | |||
D13152 | rPa15444aa7919 Remove PhabricatorStartup::getGlobal/setGlobal mechanism |
Event Timeline
Comment Actions
Since this issue doesn't seem like a priority and i am in need of this feature, i would like to propose a possible solution:
Using php's $GLOBALS you could set those values in say $GLOBALS['PREAMBLE']['SERVER'] inside the preamble script and have PhabricatorStartup::normalizeInput merge them into $_SERVER after filtering happened.
This obviously means that the preamble script has to be configured using $GLOBALS, instead of setting $_SERVER directly.
Example (inside preamble.php):
<?php $GLOBALS['PREAMBLE'] = array ( 'SERVER' => array ( 'REMOTE_ADDR' => $_SERVER['HTTP_X_FORWARDED_FOR'], 'HTTPS' => true, ), );
I tested it on my phabricator instance and it seemed to have worked, though me not being a php programmer might mean that i overlooked some things. ;)
Will attach a diff for review!