[drupal-devel] drupal site on forwarded server

openwereld.net openwereld.net at home.nl
Wed Sep 7 21:01:14 UTC 2005


Hi list,

I entered this first as an issue on the drupal site at 
http://drupal.org/node/30173, but got no reaction there. It's probably 
more suitable for a developer's discussion.

If a drupal site is situated on an intranet and external requests are 
forwarded to it, the function 'conf_init' in bootstrap.inc uses the 
'wrong' host name. It always uses $_SERVER['HTTP_HOST'], while in case 
of request forwarding it could use $_SERVER['HTTP_X_FORWARDED_SERVER'].
The following code fragment (in conf_init() ) should improve this:

if( isset( $_SERVER['HTTP_X_FORWARDED_SERVER'] ) )
$server = explode('.', rtrim($_SERVER['HTTP_X_FORWARDED_SERVER'], '.'));
else
$server = explode('.', rtrim($_SERVER['HTTP_HOST'], '.'));


john.




More information about the drupal-devel mailing list