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'], '.'));

Comments

magico’s picture

Priority: Normal » Minor

Verified.
Any user having this problem? Seems minor to me.

bdragon’s picture

Version: x.y.z » 6.x-dev
Status: Active » Closed (duplicate)

This is fixed in Drupal 6. See the admin/settings/performance page.

davesmith-1’s picture

Version: 6.x-dev » 5.2
Priority: Minor » Normal

Hi, amazingly, this is a problem for me. I am glad to see that it is fixed in v6, but is there a (relatively) simple mod we can make to get it active in 5.2.

I understand that this is not a big problem for most people, but it is a significant irritation for me.

This is affecting my site in particular with results from search, and in the acknowledgements of form submissions. (www.corpdata.co.uk should any of you be interested.)

Any help gratefully received.

davesmith-1’s picture

Priority: Normal » Minor

OK, stupidity rules on our part. Change 4base_url in settings.php and we are fine. Sorry for the earlier post.

jbarwick’s picture

But not fixed in 7 ....

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

Did the trick

jbarwick’s picture

I can't use the 4base_url setting...multiple applications on server...dependencies...

I guess I could use an php_admin_value in http.conf for this vhost....

But...the "if" statement works just fine. I use this in our own applications.