diff --git a/core/INSTALL.txt b/core/INSTALL.txt
index 18510eb989..2f763509bf 100644
--- a/core/INSTALL.txt
+++ b/core/INSTALL.txt
@@ -201,36 +201,40 @@ INSTALLATION
b. Missing settings file.
- Drupal will try to automatically create a settings.php configuration file,
- which is normally in the directory sites/default (to avoid problems when
- upgrading, Drupal is not packaged with this file). If auto-creation fails,
- you will need to create this file yourself, using the file
- sites/default/default.settings.php as a template.
+ Drupal will try to automatically create settings.php and services.yml
+ files, which are normally in the directory settings (to avoid
+ problems when upgrading, Drupal is not packaged with this file). If
+ auto-creation of either file fails, you will need to create the file
+ yourself. Use the template core/default.settings.php or
+ core/default.services.yml respectively.
For example, on a Unix/Linux command line, you can make a copy of the
default.settings.php file with the command:
- cp sites/default/default.settings.php sites/default/settings.php
+ cp core/default.settings.php settings/settings.php
+ cp core/default.services.yml settings/services.yml
Next, grant write privileges to the file to everyone (including the web
server) with the command:
- chmod a+w sites/default/settings.php
+ chmod a+w settings/settings.php
+ chmod a+w settings/services.yml
Be sure to set the permissions back after the installation is finished!
Sample command:
- chmod go-w sites/default/settings.php
+ chmod go-w settings/settings.php
+ chmod go-w settings/services.yml
c. Write permissions after install.
- The install script will attempt to write-protect the settings.php file and
- the sites/default directory after saving your configuration. If this
- fails, you will be notified, and you can do it manually. Sample commands
- from a Unix/Linux command line:
+ The install script will attempt to write-protect the settings.php file
+ after saving your configuration. If this fails, you will be notified, and
+ you can do it manually. Sample commands from a Unix/Linux command line:
- chmod go-w sites/default/settings.php
- chmod go-w sites/default
+ chmod go-w settings/settings.php
+ chmod go-w settings/services.yml
+ chmod go-w settings
4. Verify that the site is working.
@@ -355,9 +359,9 @@ Drupal can be reinstalled without downloading and extracting the Drupal release.
1. Drop all the tables in your database.
-2. Remove everything in sites/default/files.
+2. Remove everything in the files directory.
-3. Remove sites/default/settings.php.
+3. Remove settings.php.
4. Follow the Installation Instructions above starting from Step 3 (Run the
install script).
@@ -391,28 +395,28 @@ MULTISITE CONFIGURATION
A single Drupal installation can host several Drupal-powered sites, each with
its own individual configuration.
-For this to work you need the file sites/sites.php to exist. Make a copy of
-the example.sites.php file:
+For this to work you need to enable the commented out $sites variable in the
+settings.php in Drupal's root directory, like so:
- $ cp sites/example.sites.php sites/sites.php
+ $sites = array();
Additional site configurations are created in subdirectories within the 'sites'
directory. Each subdirectory must have a 'settings.php' file, which specifies
the configuration settings. The easiest way to create additional sites is to
-copy file 'default.settings.php' from the 'sites/default' directory into the
-new site directory with file name 'settings.php' and modify as appropriate.
+copy file 'core/default.settings.php' into the new site directory with file name
+'settings.php' and modify as appropriate.
+
The new directory name is constructed from the site's URL. The configuration
for www.example.com could be in 'sites/example.com/settings.php' (note that
'www.' should be omitted if users can access your site at http://example.com/).
- $ cp sites/default/defaults.settings.php sites/example.com/settings.php
+ $ cp core/default.settings.php sites/example.com/settings.php
Sites do not have to have a different domain. You can also use subdomains and
subdirectories for Drupal sites. For example, example.com, sub.example.com, and
sub.example.com/site3 can all be defined as independent Drupal sites. The setup
for a configuration such as this would look like the following:
- sites/default/settings.php
sites/example.com/settings.php
sites/sub.example.com/settings.php
sites/sub.example.com.site3/settings.php
@@ -427,7 +431,7 @@ first configuration it finds:
sites/www.sub.example.com/settings.php
sites/sub.example.com/settings.php
sites/example.com/settings.php
- sites/default/settings.php
+ settings.php
If you are installing on a non-standard port, the port number is treated as the
deepest subdomain. For example: http://www.example.com:8080/ could be loaded
diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index afd267adcf..56339ff2ec 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -161,6 +161,26 @@
*/
define('DRUPAL_ROOT', dirname(dirname(__DIR__)));
+/**
+ * Returns the appropriate configuration directory.
+ *
+ * Temporary backwards-compatibility layer for Drush.
+ *
+ * @deprecated 8.x-dev
+ * Use \Drupal\Core\Site\Site::getPath() instead.
+ *
+ * @internal
+ */
+function conf_path() {
+ if (strpos(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)[1]['function'], 'drush') === FALSE) {
+ throw new \Exception('conf_path() is retained for Drush compatibility only.');
+ }
+ // When called from _drush_bootstrap_drupal_site_validate() on testbots, this
+ // function is supposed to return the site path of the parent site, which is
+ // '' (the document root). Ensure that the returned path is relative.
+ // @see https://github.com/drush-ops/drush/blob/master/includes/bootstrap.inc#L782
+ return '.';
+}
/**
* Returns the path of a configuration directory.
*
diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index 18f6a398bf..c4b0c2fb30 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -25,6 +25,7 @@
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Logger\LoggerChannelFactory;
use Drupal\Core\Site\Settings;
+use Drupal\Core\Site\Site;
use Drupal\Core\StringTranslation\Translator\FileTranslation;
use Drupal\Core\StackMiddleware\ReverseProxyMiddleware;
use Drupal\Core\StreamWrapper\PublicStream;
@@ -338,6 +339,12 @@ function install_begin_request($class_loader, &$install_state) {
$site_path = empty($install_state['site_path']) ? DrupalKernel::findSitePath($request, FALSE) : $install_state['site_path'];
Settings::initialize(dirname(dirname(__DIR__)), $site_path, $class_loader);
+ // Initialize the site directory.
+ // This primes the site path to be used during installation, to allow an empty
+ // site folder to be prepared in the /sites directory into which Drupal will
+ // be installed.
+ Site::initInstaller(DRUPAL_ROOT);
+
// Ensure that procedural dependencies are loaded as early as possible,
// since the error/exception handlers depend on them.
require_once __DIR__ . '/../modules/system/system.install';
@@ -442,7 +449,7 @@ function install_begin_request($class_loader, &$install_state) {
$directory = $GLOBALS['config']['locale.settings']['translation']['path'];
}
else {
- $directory = $site_path . '/files/translations';
+ $directory = Site::getPath('files/translations');
}
$container->set('string_translator.file_translation', new FileTranslation($directory));
$container->get('string_translation')
@@ -1174,8 +1181,7 @@ function install_verify_completed_task() {
function install_verify_database_settings($site_path) {
if ($database = Database::getConnectionInfo()) {
$database = $database['default'];
- $settings_file = './' . $site_path . '/settings.php';
- $errors = install_database_errors($database, $settings_file);
+ $errors = install_database_errors($database);
if (empty($errors)) {
return TRUE;
}
@@ -1909,9 +1915,8 @@ function install_check_translations($langcode, $server_pattern) {
$readable = FALSE;
$writable = FALSE;
// @todo: Make this configurable.
- $site_path = \Drupal::service('site.path');
- $files_directory = $site_path . '/files';
- $translations_directory = $site_path . '/files/translations';
+ $files_directory = Site::getPath('files');
+ $translations_directory = Site::getPath('files/translations');
$translations_directory_exists = FALSE;
$online = FALSE;
@@ -2088,8 +2093,9 @@ function install_check_requirements($install_state) {
$readable = FALSE;
$writable = FALSE;
$site_path = './' . \Drupal::service('site.path');
- $file = $site_path . "/{$default_file_info['file']}";
- $default_file = "./sites/default/{$default_file_info['file_default']}";
+ $conf_path = './' . conf_path(FALSE);
+ $file = $conf_path . "/{$default_file_info['file']}";
+ $default_file = "./core/{$default_file_info['file_default']}";
$exists = FALSE;
// Verify that the directory exists.
if (drupal_verify_install_file($site_path, FILE_EXIST, 'dir')) {
diff --git a/core/includes/install.inc b/core/includes/install.inc
index 45a8b141c3..c584daa7da 100644
--- a/core/includes/install.inc
+++ b/core/includes/install.inc
@@ -15,6 +15,7 @@
use Drupal\Core\Extension\ExtensionDiscovery;
use Drupal\Core\Extension\ModuleHandler;
use Drupal\Core\Site\Settings;
+use Drupal\Core\Site\Site;
/**
* Requirement severity -- Informational message only.
@@ -219,7 +220,7 @@ function drupal_get_database_types() {
*/
function drupal_rewrite_settings($settings = [], $settings_file = NULL) {
if (!isset($settings_file)) {
- $settings_file = \Drupal::service('site.path') . '/settings.php';
+ $settings_file = Site::getPath('settings.php');
}
// Build list of setting names and insert the values into the global namespace.
$variable_names = [];
@@ -678,6 +679,9 @@ function drupal_install_system($install_state) {
*
* @return
* TRUE on success or FALSE on failure. A message is set for the latter.
+ *
+ * @todo Do not automatically call into drupal_install_fix_file().
+ * @see https://drupal.org/node/1616266
*/
function drupal_verify_install_file($file, $mask = NULL, $type = 'file', $autofix = TRUE) {
$return = TRUE;
diff --git a/core/includes/update.inc b/core/includes/update.inc
index 2021a66231..b6639ce481 100644
--- a/core/includes/update.inc
+++ b/core/includes/update.inc
@@ -66,6 +66,34 @@ function update_check_incompatibility($name, $type = 'module') {
return FALSE;
}
+/**
+ * Returns whether the settings file requirement has been satisfied.
+ *
+ * @return array
+ * A requirements info array.
+ */
+function update_settings_file_requirements() {
+ $requirements = array();
+
+ // Check whether settings.php needs to be rewritten.
+ $settings_file = Site::getPath('settings.php');
+ $writable = drupal_verify_install_file($settings_file, FILE_EXIST | FILE_READABLE | FILE_WRITABLE);
+ $requirements['settings file']['title'] = 'Settings file';
+ if ($writable) {
+ $requirements['settings file'] += array(
+ 'value' => 'settings.php is writable.',
+ );
+ }
+ else {
+ $requirements['settings file'] += array(
+ 'value' => 'settings.php is not writable.',
+ 'severity' => REQUIREMENT_ERROR,
+ 'description' => 'Drupal requires write permissions to ' . $settings_file . ' during the update process. If you are unsure how to grant file permissions, consult the online handbook.',
+ );
+ }
+ return $requirements;
+}
+
/**
* Returns whether the minimum schema requirement has been satisfied.
*
diff --git a/core/lib/Drupal/Core/Database/Driver/sqlite/Install/Tasks.php b/core/lib/Drupal/Core/Database/Driver/sqlite/Install/Tasks.php
index f5cb289329..8f54a39e82 100644
--- a/core/lib/Drupal/Core/Database/Driver/sqlite/Install/Tasks.php
+++ b/core/lib/Drupal/Core/Database/Driver/sqlite/Install/Tasks.php
@@ -6,6 +6,7 @@
use Drupal\Core\Database\Driver\sqlite\Connection;
use Drupal\Core\Database\DatabaseNotFoundException;
use Drupal\Core\Database\Install\Tasks as InstallTasks;
+use Drupal\Core\Site\Site;
/**
* Specifies installation tasks for SQLite databases.
diff --git a/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php b/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php
index 09d866f288..58875e62f9 100644
--- a/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php
+++ b/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php
@@ -6,6 +6,7 @@
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Locale\CountryManagerInterface;
+use Drupal\Core\Site\Site;
use Drupal\Core\Site\Settings;
use Drupal\Core\State\StateInterface;
use Drupal\user\UserStorageInterface;
@@ -128,6 +129,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
// Warn about settings.php permissions risk
$settings_dir = $this->sitePath;
$settings_file = $settings_dir . '/settings.php';
+
// Check that $_POST is empty so we only show this message when the form is
// first displayed, not on the next page after it is submitted. (We do not
// want to repeat it multiple times because it is a general warning that is
diff --git a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php
index b82bb01ae1..4d9d185e23 100644
--- a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php
+++ b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php
@@ -141,7 +141,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
];
$form['errors'] = [];
- $form['settings_file'] = ['#type' => 'value', '#value' => $settings_file];
return $form;
}
diff --git a/core/lib/Drupal/Core/Site/Settings.php b/core/lib/Drupal/Core/Site/Settings.php
index c6fbed659f..5f6f4f9dc4 100644
--- a/core/lib/Drupal/Core/Site/Settings.php
+++ b/core/lib/Drupal/Core/Site/Settings.php
@@ -121,8 +121,24 @@ public static function initialize($app_root, $site_path, &$class_loader) {
$config = [];
$databases = [];
- if (is_readable($app_root . '/' . $site_path . '/settings.php')) {
- require $app_root . '/' . $site_path . '/settings.php';
+ // Read the global /settings/settings.php file.
+ // Allow it to set/override the following variables:
+ $sites = NULL;
+ $conf_path = NULL;
+ // Exclude it for test requests to prevent settings of the test runner from
+ // leaking into the test environment.
+ if (!drupal_valid_test_ua() && is_readable(DRUPAL_ROOT . '/settings/settings.php')) {
+ require DRUPAL_ROOT . '/settings/settings.php';
+ }
+
+ // Discover the site directory.
+ Site::init(DRUPAL_ROOT, $sites, $conf_path);
+
+ // Read settings.php of the actual site, unless it is the root/default site.
+ // Concatenation is safe here, since $conf_path is known to be not empty.
+ $conf_path = Site::getPath();
+ if ($conf_path !== '' && is_readable(DRUPAL_ROOT . '/' . $conf_path . '/settings.php')) {
+ require DRUPAL_ROOT . '/' . $conf_path . '/settings.php';
}
// Initialize Database.
diff --git a/core/modules/content_moderation/src/Form/ContentModerationConfigureForm.php b/core/modules/content_moderation/src/Form/ContentModerationConfigureForm.php
index f43451ec63..7e87604983 100644
--- a/core/modules/content_moderation/src/Form/ContentModerationConfigureForm.php
+++ b/core/modules/content_moderation/src/Form/ContentModerationConfigureForm.php
@@ -113,6 +113,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
],
'operations' => [
'#type' => 'operations',
+ '#attached' => ['library' => ['core/drupal.dialog.ajax']],
'#links' => [
'select' => [
'title' => $this->t('Select'),
diff --git a/core/modules/content_moderation/tests/src/Functional/ContentModerationWorkflowTypeTest.php b/core/modules/content_moderation/tests/src/Functional/ContentModerationWorkflowTypeTest.php
index cbe5807a5f..5fd9e2b59f 100644
--- a/core/modules/content_moderation/tests/src/Functional/ContentModerationWorkflowTypeTest.php
+++ b/core/modules/content_moderation/tests/src/Functional/ContentModerationWorkflowTypeTest.php
@@ -92,7 +92,9 @@ public function testNewWorkflow() {
$session->fieldDisabled('type_settings[published]');
$session->fieldDisabled('type_settings[default_revision]');
- $this->drupalGet('admin/config/workflow/workflows/manage/test/type/node');
+ $this->drupalGet('admin/config/workflow/workflows/manage/test');
+ $this->assertSession()->libraryAttached('core/drupal.dialog.ajax');
+ $this->clickLink('Select');
$session->pageTextContains('Select the content types for the Test workflow');
foreach ($types as $type) {
$session->pageTextContains($type->label());
diff --git a/core/modules/file/tests/file_test/src/StreamWrapper/DummyReadOnlyStreamWrapper.php b/core/modules/file/tests/file_test/src/StreamWrapper/DummyReadOnlyStreamWrapper.php
index c1c36af413..91f0e80cf4 100644
--- a/core/modules/file/tests/file_test/src/StreamWrapper/DummyReadOnlyStreamWrapper.php
+++ b/core/modules/file/tests/file_test/src/StreamWrapper/DummyReadOnlyStreamWrapper.php
@@ -2,6 +2,7 @@
namespace Drupal\file_test\StreamWrapper;
+use Drupal\Core\Site\Site;
use Drupal\Core\StreamWrapper\LocalReadOnlyStream;
/**
diff --git a/core/modules/file/tests/file_test/src/StreamWrapper/DummyStreamWrapper.php b/core/modules/file/tests/file_test/src/StreamWrapper/DummyStreamWrapper.php
index 6ce842470f..4ec2612107 100644
--- a/core/modules/file/tests/file_test/src/StreamWrapper/DummyStreamWrapper.php
+++ b/core/modules/file/tests/file_test/src/StreamWrapper/DummyStreamWrapper.php
@@ -2,6 +2,7 @@
namespace Drupal\file_test\StreamWrapper;
+use Drupal\Core\Site\Site;
use Drupal\Core\StreamWrapper\LocalStream;
/**
diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php
index b47d2d7e85..e9fc31a211 100644
--- a/core/modules/simpletest/src/TestBase.php
+++ b/core/modules/simpletest/src/TestBase.php
@@ -9,6 +9,7 @@
use Drupal\Core\Database\Database;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\Site\Settings;
+use Drupal\Core\Site\Site;
use Drupal\Core\StreamWrapper\PublicStream;
use Drupal\Core\Test\TestDatabase;
use Drupal\Core\Test\TestSetupTrait;
@@ -1169,7 +1170,11 @@ private function prepareEnvironment() {
// After preparing the environment and changing the database prefix, we are
// in a valid test environment.
+ if (!is_dir(DRUPAL_ROOT . '/' . $this->siteDirectory)) {
+ throw new \RuntimeException("Test site directory '$this->siteDirectory' does not exist.");
+ }
drupal_valid_test_ua($this->databasePrefix);
+ Site::setUpTest();
// Reset settings.
new Settings([
@@ -1283,6 +1288,11 @@ private function restoreEnvironment() {
drupal_valid_test_ua(FALSE);
}
+ Site::tearDownTest();
+
+ // Restore stream wrappers of the test runner.
+ file_get_stream_wrappers();
+
// Restore original shutdown callbacks.
$callbacks = &drupal_register_shutdown_function();
$callbacks = $this->originalShutdownCallbacks;
diff --git a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php
index b5cb96b8cc..4f287586e8 100644
--- a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php
+++ b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php
@@ -4,6 +4,7 @@
use Drupal\Core\DrupalKernel;
use Drupal\KernelTests\KernelTestBase;
+use Drupal\Core\Site\Site;
use Symfony\Component\HttpFoundation\Request;
/**
@@ -17,6 +18,9 @@ class DrupalKernelTest extends KernelTestBase {
* {@inheritdoc}
*/
protected function setUp() {
+ // Initialize the test Site singleton, so that Site::getPath() works.
+ Site::init(DRUPAL_ROOT);
+
// DrupalKernel relies on global $config_directories and requires those
// directories to exist. Therefore, create the directories, but do not
// invoke KernelTestBase::setUp(), since that would set up further
diff --git a/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php b/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php
index 00dfa0b8d3..413aa6bd5f 100644
--- a/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php
@@ -2,6 +2,7 @@
namespace Drupal\KernelTests\Core\File;
+use Drupal\Core\Site\Site;
use Drupal\Core\StreamWrapper\StreamWrapperInterface;
use Drupal\file_test\StreamWrapper\DummyReadOnlyStreamWrapper;
diff --git a/core/tests/Drupal/KernelTests/Core/Site/SettingsRewriteTest.php b/core/tests/Drupal/KernelTests/Core/Site/SettingsRewriteTest.php
index 0507871124..623616ab31 100644
--- a/core/tests/Drupal/KernelTests/Core/Site/SettingsRewriteTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Site/SettingsRewriteTest.php
@@ -4,6 +4,7 @@
use Drupal\Core\Site\Settings;
use Drupal\KernelTests\KernelTestBase;
+use Drupal\Core\Site\Site;
/**
* Tests the drupal_rewrite_settings() function.
diff --git a/core/tests/Drupal/Tests/WebAssert.php b/core/tests/Drupal/Tests/WebAssert.php
index 4f7a7d292c..c06edba58c 100644
--- a/core/tests/Drupal/Tests/WebAssert.php
+++ b/core/tests/Drupal/Tests/WebAssert.php
@@ -597,4 +597,37 @@ public function pageTextContainsOnce($text) {
throw new ResponseTextException($message, $this->session->getDriver());
}
+ /**
+ * Get the Drupal settings for the current page.
+ *
+ * @return array
+ * An array of Drupal settings for the current page.
+ */
+ protected function getDrupalSettings() {
+ return json_decode($this->session->getPage()->find('css', '[data-drupal-selector="drupal-settings-json"]')->getHtml(), TRUE);
+ }
+
+ /**
+ * Assert a library has been attached to the current page.
+ *
+ * @param string $library_name
+ * The name of the library which should appear on the current page.
+ *
+ * @throws \Behat\Mink\Exception\ExpectationException
+ */
+ public function libraryAttached($library_name) {
+ $drupal_settings = $this->getDrupalSettings();
+ $libraries = isset($drupal_settings['ajaxPageState']['libraries']) ? explode(',', $drupal_settings['ajaxPageState']['libraries']) : [];
+ $this->assert(in_array($library_name, $libraries), sprintf('The library "%s" should exist on the current page, but it does not.', $library_name));
+ }
+
+ /**
+ * Assert a library has been attached to the current page.
+ */
+ public function libraryNotAttached($library_name) {
+ $drupal_settings = $this->getDrupalSettings();
+ $libraries = isset($drupal_settings['ajaxPageState']['libraries']) ? explode(',', $drupal_settings['ajaxPageState']['libraries']) : [];
+ $this->assert(!in_array($library_name, $libraries), sprintf('The library "%s" should not exist on the current page, but it does.', $library_name));
+ }
+
}
diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php
index ae64d2ffe8..5bcecc267f 100644
--- a/sites/default/default.settings.php
+++ b/sites/default/default.settings.php
@@ -342,10 +342,11 @@
* configuration requires the IP addresses of all remote proxies to be
* specified in $settings['reverse_proxy_addresses'] to work correctly.
*
- * Enable this setting to get Drupal to determine the client IP from the
- * X-Forwarded-For header. If you are unsure about this setting, do not have a
- * reverse proxy, or Drupal operates in a shared hosting environment, this
- * setting should remain commented out.
+ * Enable this setting to get Drupal to determine the client IP from
+ * the X-Forwarded-For header (or $settings['reverse_proxy_header'] if set).
+ * If you are unsure about this setting, do not have a reverse proxy,
+ * or Drupal operates in a shared hosting environment, this setting
+ * should remain commented out.
*
* In order for this setting to be used you must specify every possible
* reverse proxy IP address in $settings['reverse_proxy_addresses'].
@@ -364,35 +365,34 @@
# $settings['reverse_proxy_addresses'] = ['a.b.c.d', ...];
/**
- * Reverse proxy trusted headers.
- *
- * Sets which headers to trust from your reverse proxy.
- *
- * Common values are:
- * - \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_ALL
- * - \Symfony\Component\HttpFoundation\Request::HEADER_FORWARDED
- *
- * Note the default value of
- * @code
- * \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_ALL | \Symfony\Component\HttpFoundation\Request::HEADER_FORWARDED
- * @endcode
- * is not secure by default. The value should be set to only the specific
- * headers the reverse proxy uses. For example:
- * @code
- * \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_ALL
- * @endcode
- * This would trust the following headers:
- * - X_FORWARDED_FOR
- * - X_FORWARDED_HOST
- * - X_FORWARDED_PROTO
- * - X_FORWARDED_PORT
- *
- * @see \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_ALL
- * @see \Symfony\Component\HttpFoundation\Request::HEADER_FORWARDED
- * @see \Symfony\Component\HttpFoundation\Request::setTrustedProxies
+ * Set this value if your proxy server sends the client IP in a header
+ * other than X-Forwarded-For.
*/
-# $settings['reverse_proxy_trusted_headers'] = \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_ALL | \Symfony\Component\HttpFoundation\Request::HEADER_FORWARDED;
+# $settings['reverse_proxy_header'] = 'X_CLUSTER_CLIENT_IP';
+/**
+ * Set this value if your proxy server sends the client protocol in a header
+ * other than X-Forwarded-Proto.
+ */
+# $settings['reverse_proxy_proto_header'] = 'X_FORWARDED_PROTO';
+
+/**
+ * Set this value if your proxy server sends the client protocol in a header
+ * other than X-Forwarded-Host.
+ */
+# $settings['reverse_proxy_host_header'] = 'X_FORWARDED_HOST';
+
+/**
+ * Set this value if your proxy server sends the client protocol in a header
+ * other than X-Forwarded-Port.
+ */
+# $settings['reverse_proxy_port_header'] = 'X_FORWARDED_PORT';
+
+/**
+ * Set this value if your proxy server sends the client protocol in a header
+ * other than Forwarded.
+ */
+# $settings['reverse_proxy_forwarded_header'] = 'FORWARDED';
/**
* Page caching: