Hi everyone. I have a very simple looking problem which seems to be out of my ability to solve. Put simply: I cannot login to my Drupal installation if I access it via the IP address. I can only login if I access it by its NetBIOS name, even if I do it from the same machine. I am running Apache on a different port, but I have done the same with other installations and they all ran fine.
http://mail:8080 --> login successful
http://10.1.1.100:8080 --> login unsuccessful
It is installed on a Windows Server 2003 machine. I am using WAMP5 1.7.1 (PHP 5.2.2, MySQL 5.0.37, Apache 2.2.4) and Drupal 5.1.
Has anyone else encountered been in a similar situation? Any information would really be appreciated.
Comments
Looks like it could be a "virtual host"/multisite problem
This looks like a problem with site defiitions. I imagine you have a single default site set up, so have a sites/all/default/settings.php file that contains a $baseurl = "http://mail:8080" or some such line in it.
This is fine, but it means that all URLs that Drupal generates (including the form post and cookie required for login to work) will use the $baseurl. Normally that's what you want, but in your case it isn't because you've got more than one name for your server. If (for example) you visit 10.1.1.1:8080, and it returns a cookie that's valid for "mail:8080", then your browser won't return it to 10.1.1.1:8080, so login won't appear to work.
You've got two choices:
1) Remove the $baseurl setting in settings.php. This should work, but still leaves certain issues and uncertainties. I'd personally vouch for the next idea instead, but this should work to test it out.
2) Create two sites. Basically, create another directory in sites/all, perhaps something like sites/all/10.1.1.1 and copy settings.php into it. Change the $baseurl to be "http://10.1.1.1:8080". If you want, you can change other things too, like make the theme different, but that's another story.
2a) Optionally, create another directory, perhaps called "mail" with another settings.php in it, with the $baseurl set to "http://mail:8080". That way, Drupal will use that one instead of the default when accessing the site by it's name.
In short, Drupal looks at the URL you typed into your browser for a corresponding settings.php file. If it finds one, it'll use that, otherwise it'll use the default one. This is the basis for Drupal's virtual hosting/multisite capability if that's of any interest. If the default settings.php has a $baseurl in it, then it'll use that, which will stop you being able to access your machine if you can't resolve the name "mail" (which you can't outside your intranet).