Created
October 10, 2012 06:31
-
-
Save klaasvw/3863495 to your computer and use it in GitHub Desktop.
Drupal behind a proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @file | |
* This snippet shows how you can run drupal from a different host behind a proxy. | |
* Include this code at the bottom of your settings.php file. | |
*/ | |
// Set the hosts that are allowed to be proxied to this drupal installation. | |
$conf['reverse_proxy_addresses'] = array('example.com', 'example2.com'); | |
// If the request was proxied from a different domain we change the internal URL. | |
if (isset($_SERVER['HTTP_X_FORWARDED_HOST']) && in_array($_SERVER['HTTP_X_FORWARDED_HOST'], $conf['reverse_proxy_addresses'])) { | |
$base_url = 'http://' . $_SERVER['HTTP_X_FORWARDED_HOST']; | |
$conf['reverse_proxy'] = TRUE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment