Skip to content

Commit

Permalink
Add check for HTTP_X_FORWARDED_FOR as it might not always exist
Browse files Browse the repository at this point in the history
  • Loading branch information
back-2-95 committed Jun 4, 2020
1 parent af59a9a commit ce9111d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/DrupalEnvDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function __construct($settings_dir) {
}

// Set reverse proxy
if (isset($_SERVER['REMOTE_ADDR'])) {
if (isset($_SERVER['REMOTE_ADDR']) && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
if ($_SERVER['REMOTE_ADDR'] !== $_SERVER['HTTP_X_FORWARDED_FOR']) {
$settings['reverse_proxy'] = TRUE;
$settings['reverse_proxy_addresses'] = [$_SERVER['REMOTE_ADDR']];
Expand Down

0 comments on commit ce9111d

Please sign in to comment.