http://locahost -v- http://127.0.0.1 and Vista Wierdness

Problems with the Windows version of XAMPP, questions, comments, and anything related.

http://locahost -v- http://127.0.0.1 and Vista Wierdness

Postby clive.kinton » 01. October 2009 19:31

Hi Guys & Girls,

I've been using Apache on Linux for some time, but xampp + Windows is new to me. A friend has a problem and he asked if I could look into it. It's a bit strange, but perhaps somebody knows what is wrong.

The basic issue. End user is trying to limit access to /htdocs/images to localhost only. This is done with .htaccess in /htdocs/images.
If he enters http://localhost -or- http://127.0.0.1 on an unprotected url, everything is fine. If he does it with the /htdocs/images directory http://127.0.0.1 will work, but http://localhost is refused 403.

It should not make *any* difference with the url being http://localhost -v- http://127.0.0.1 to the operation of the restriction. Here are the specifics;

Code: Select all
DocumentRoot "C:/xampp/experiment/htdocs"
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory "C:/xampp/experiment/htdocs">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>


With a sub directory /images containing .htaccess reading:

Code: Select all
Order deny,allow
Deny from all
Allow from localhost
Allow from 127.0.0.1


http://127.0.0.1/images/index.html
Serves as expected

http://localhost/images/index.html
Throws a 403 {log entry: vista-pc - - [01/Oct/2009:08:19:22 +0100] "GET /images/index.html HTTP/1.1" 403 ....}

ASIDE: It has resolved localhost to it's actual hostname of 'vista-pc' *so IP to NAME is doing something. vista-PC is the hostname of the box concerned, and this name only exists on that box. There are no DNS entries for it, it's not a share of any kind.

Now, on a Linux server running plain old Apache (slight difference in paths and the default is set up as a 'virtual') it all works as expected with these settings;

Server version: Apache/2.2.9 (Ubuntu)
Server built: Jul 10 2009 18:43:23

Code: Select all
DocumentRoot /home/www/htdocs/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /home/www/htdocs/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>


and a sub directory /htdocs/images with .htaccess within reading:
Code: Select all
Order deny,allow
Deny from all
Allow from localhost
Allow from 127.0.0.1


http://localhost/images/index.html
http://127.0.0.1/images/index.html

Both serve as they should The log for the call shows;
Code: Select all
localhost - - [01/Oct/2009:08:15:07 +0100] "GET /images/index.html HTTP/1.1" 200 ....

The Linux box correctly reports 'localhost' rather than the actual host name

This has been driving us crazy for a couple of days now. I can't make up my mind if this is a config error, a Vista issue or a plain old bug. I have an inclination that it is a name resolution error of some kind. I've made sure there are entries in hosts and lmhosts.sam, but nothing will get Vista to work as expected. It makes no sense to me why with the xampp package on Vista with a simple .htaccess restriction fails with a 403's for 'Localhost', but not 127.0.0.1 ?

Has anyone else seen this problem?
clive.kinton
 
Posts: 1
Joined: 01. October 2009 19:01

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 131 guests