Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.419 diff -u -p -r1.419 bootstrap.inc --- includes/bootstrap.inc 16 Sep 2010 01:10:38 -0000 1.419 +++ includes/bootstrap.inc 19 Sep 2010 20:38:36 -0000 @@ -565,8 +565,23 @@ function drupal_settings_initialize() { if (file_exists(DRUPAL_ROOT . '/' . conf_path() . '/settings.php')) { include_once DRUPAL_ROOT . '/' . conf_path() . '/settings.php'; + $trust_proxy_headers = isset($conf['reverse_proxy']) ? $conf['reverse_proxy'] : FALSE; + } + else { + // This should only happen during the initial install. While the + // installer does not currently require this to be correct at this + // time, trusting headers at this point allows future changes to our + // install procedure to include, for example, AJAX callbacks prior + // to the creation of settings.php. + $trust_proxy_headers=TRUE; + } + + if ($trust_proxy_headers) { + $is_https = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == "https") || (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && $_SERVER['HTTP_FRONT_END_HTTPS'] == 'on'); + } + else { + $is_https = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on'; } - $is_https = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on'; if (isset($base_url)) { // Parse fixed base URL from settings.php. Index: includes/install.core.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/install.core.inc,v retrieving revision 1.30 diff -u -p -r1.30 install.core.inc --- includes/install.core.inc 14 Sep 2010 21:42:05 -0000 1.30 +++ includes/install.core.inc 19 Sep 2010 20:38:37 -0000 @@ -1014,6 +1014,11 @@ function install_settings_form_submit($f 'value' => drupal_hash_base64(drupal_random_bytes(55)), 'required' => TRUE, ); + if (!file_exists(DRUPAL_ROOT . '/' . conf_path() . '/settings.php')) { + if ( (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && strtolower($_SERVER['HTTP_X_FORWARDED_FOR']) == "https") || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == "https") || (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && $_SERVER['HTTP_FRONT_END_HTTPS'] == 'on') ) { + $settings['reverse_proxy'] = TRUE; + } + } drupal_rewrite_settings($settings); // Indicate that the settings file has been verified, and check the database // for the last completed task, now that we have a valid connection. This Index: includes/install.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/install.inc,v retrieving revision 1.142 diff -u -p -r1.142 install.inc --- includes/install.inc 22 Aug 2010 15:31:18 -0000 1.142 +++ includes/install.inc 19 Sep 2010 20:38:38 -0000 @@ -202,25 +202,6 @@ function drupal_install_profile_distribu } /** - * Auto detect the base_url with PHP predefined variables. - * - * @param $file - * The name of the file calling this function so we can strip it out of - * the URI when generating the base_url. - * @return - * The auto-detected $base_url that should be configured in settings.php - */ -function drupal_detect_baseurl($file = 'install.php') { - $proto = $_SERVER['HTTPS'] ? 'https://' : 'http://'; - $host = $_SERVER['SERVER_NAME']; - $port = ($_SERVER['SERVER_PORT'] == 80 ? '' : ':' . $_SERVER['SERVER_PORT']); - $uri = preg_replace("/\?.*/", '', $_SERVER['REQUEST_URI']); - $dir = str_replace("/$file", '', $uri); - - return "$proto$host$port$dir"; -} - -/** * Detect all supported databases that are compiled into PHP. * * @return Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.507 diff -u -p -r1.507 system.install --- modules/system/system.install 17 Sep 2010 02:28:37 -0000 1.507 +++ modules/system/system.install 19 Sep 2010 20:38:39 -0000 @@ -54,6 +54,12 @@ function system_requirements($phase) { 'value' => $software, ); + // Try to detect reverse proxy. + $requirements['reverse_proxy'] = array( + 'title' => $t('Reverse proxy'), + 'value' => isset($_SERVER['HTTP_X_FORWARDED_FOR']) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) || isset($_SERVER['HTTP_FRONT_END_HTTPS']) ? "Detected" : "Not detected" . ' ('. l($t('more information'), 'http://drupal.org/node/425990') .')', + ); + // Test PHP version and show link to phpinfo() if it's available $phpversion = phpversion(); if (function_exists('phpinfo')) {