WAN access not working with port forward

L. Allen Poole - March 28, 2005 - 05:37

Hi -

I've got my router forwarding port 8081 to the machine running drupal on my LAN. (Port 80 conflicts with another machine.) I've told Apache to listen on 8081, and from outside my LAN I can see pages it serves up... but not drupal.

After appending 8081 in my drupal conf.php file
$base_url = "http://MyServer'sLocalIP:8081/drupal";
I can access my drupal site from other computers on my LAN at http://MyServer'sLocalIP:8081/drupal.

Browsers outside the LAN directed to "http://MyStaticIP:8081/drupal" get a reply from "http://MyServer'sName:8081/drupal", which they can't resolve. Seems that incoming traffic is correctly directed to Apache/drupal, but drupal's sending the wrong URL back with its responses.

Specifying my WAN IP address in conf.php
$base_url = "http://MyStaticIP:8081/drupal";
makes drupal NOT work from either LAN or WAN.
Browsers directed to "http://MyStaticIP:8081/drupal" STILL receive a reply from drupal at "http://MyServer'sName:8081/drupal".

Where, aside from conf.php, can I tell drupal to present a local URL for LAN traffic and a WAN URL for WAN traffic?

Suggestions?

Thanks,
Allen

Take a look at this

clydefrog - March 28, 2005 - 17:04

I've tried this... makes things worse

L. Allen Poole - March 28, 2005 - 17:18

Adding this code in place of
$base_url = "http://192.168.1.123:8081/drupal";
renders drupal inoperable on both LAN and WAN.

Thanks,
Allen

Does the tolerant base URL snippet support alternative ports?

L. Allen Poole - March 28, 2005 - 17:39

I don't know any more php than I've learned in the past few days, but it looks like the tolerant base URL code doesn't explicity test for and accommodate a port specified after the host IP. Does anyone know if it needs to be extended to handle my requirement of a specified port?

Lets start with the simple

gordon - March 29, 2005 - 06:42

Lets start with the simple stuff.

What version of drupal are you running, 4.5 and 4.6 do this differently.

what are the names and full paths to the settings.php file. (4.5 the file name is different, and 4.6 the directory is different.)

To me it souds like you have the names incorrect when drupal is trying to access the settings file.
--
Gordon Heydon
Heydon Consulting

Thanks...

L. Allen Poole - March 29, 2005 - 17:21

Hi Gordon -

I appreciate your willingness to help me figure this out!

4.5.2 running under Mac OS 10.3.8

Do you mean conf.php?
/Library/WebServer/Documents/drupal/includes/conf.php

I imagine it's right because changes to this file do affect drupal's behavior.

-Allen

does it work now ?

yasheshb - November 27, 2006 - 16:10

allen.

hi, does it work now for your site on both LAN and WAN. i'm having a similar problem. LAN access works. on WAN it breaks down.

thanks.

yashesh bhatia.

Drupal on another port

GunR - June 3, 2007 - 09:10

Hi

Have you managed to solve the problem?
I'm using Linux and drupal 5.1 I have the problem partially solved.
I have:

1. Created an dyndns account and had it pointing to my router
2. Created an virtualhost entry on port 8080 in my webserver apache2 connected to the dyndns domain
3. Added entries in the hostfiles on the lan computers to point my domainname directly to the LANwebbserver
4. Changed the base url in settings.php to domainname:8080
5. Commented out the cookie transforming code in settings.php, this was required to be able to login.
6. Changed the path to settings.php to 8080.domainname/ instead of default/

Now everything works except the pictures, ie no logo
Does anyone know how to solv the rest? Changing /files to 8080/files did not work

Gunnar Sweden

Image solved

GunR - June 5, 2007 - 04:54

The image problem is related to apache settings somehow, disabling htaccess in files folder makes pictures show up.

Commenting out the cookies

andonambo - June 10, 2008 - 00:02

Hi
I had similar problems getting drupal to get past the first page on WAN, worked OK on LAN. windows server 2003 iis 6 Drupal 5 Mysql. No-Ip port forwarding 5757. There were probably a few other factors to get to this point that I gradually fixed but the last one to make it work was commenting out the cookies in settings.php

#if (isset($_SERVER['HTTP_HOST'])) {
#$domain = '.'. preg_replace('`^www.`', '', $_SERVER['HTTP_HOST']);
// Per RFC 2109, cookie domains must contain at least one dot other than the
// first. For hosts such as 'localhost', we don't set a cookie domain.
#if (count(explode('.', $domain)) > 2) {
#ini_set('session.cookie_domain', $domain);
#}
#}

Thank You

 
 

Drupal is a registered trademark of Dries Buytaert.