Host with trailing slash

Host with trailing slash

am 27.10.2007 01:29:40 von Russell Bell

We're hosting a website for customer using named virtual hosting,
which works fine except for one problem. The customer says they
can't access the website home page (www.xxx.co.nz)
from certain PC's. The browser gets a "Directory index forbidden by rule"
error.

If they use a URL of "www.xxx.co.nz/index.htm" it
works fine. But naturally they want the simpler URL to work also.

Going by the access log (below) the problem seems to be that the
http host header has a trailing slash. So Apache thinks it should
do a directory listing, which is forbidden.

Of course I don't want a directory listing, I want Apache to use
DirectoryIndex (index.htm). How can I bend Apache to my will in
this circumstance ?

We're running Apache 2.0.50 on Mandrake. Here's the access.log
and error.log entries (with customer name and IP xxx):


x.x.x.x [23/Oct/2007:13:29:40 +1300] "www.xxx.co.nz/"
398 "GET / HTTP/1.0" Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
SV1; .NET CLR 1.1.4322)

[Tue Oct 23 13:29:40 2007] [error] [client x.x.x.x]
Directory index forbidden by rule: /var/www/html/xxx/

The Vhosts.conf entry is:


ServerName xxx.co.nz
ServerAlias xxx.co.nz *.xxx.co.nz xxx.com *.xxx.com
DocumentRoot /var/www/html/xxx
DirectoryIndex /index.htm

Re: Host with trailing slash

am 27.10.2007 03:38:23 von HansH

"Russell Bell" schreef in bericht
news:fftt9b$cdf$1@aioe.org...
> We're hosting a website for customer using named virtual hosting,
> which works fine except for one problem. The customer says they
> can't access the website home page (www.xxx.co.nz)
> from certain PC's. The browser gets a "Directory index forbidden by rule"
> error.
>
> x.x.x.x [23/Oct/2007:13:29:40 +1300] "www.xxx.co.nz/"
> 398 "GET / HTTP/1.0" Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
> SV1; .NET CLR 1.1.4322)
>
> [Tue Oct 23 13:29:40 2007] [error] [client x.x.x.x]
> Directory index forbidden by rule: /var/www/html/xxx/
>
Like to know your logformat for better understanding.

For now it seems those PC are using HTTP/1.0, thus do NOT send a host header
at all. Without a hostheader the default -first defined- vhost is
responding.

Most likely those PC fall back to HTTP/1.0 while using a proxy :
Check under Tools -> Options -> Advanced


HansH

Re: Host with trailing slash

am 27.10.2007 19:17:43 von shimmyshack

On Oct 27, 2:38 am, "HansH" wrote:
> "Russell Bell" schreef in berichtnews:fftt9b$cdf$1@aioe.org...> We're hosting a website for customer using named virtual hosting,
> > which works fine except for one problem. The customer says they
> > can't access the website home page (www.xxx.co.nz)
> > from certain PC's. The browser gets a "Directory index forbidden by rule"
> > error.
>
> > x.x.x.x [23/Oct/2007:13:29:40 +1300] "www.xxx.co.nz/"
> > 398 "GET / HTTP/1.0" Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
> > SV1; .NET CLR 1.1.4322)
>
> > [Tue Oct 23 13:29:40 2007] [error] [client x.x.x.x]
> > Directory index forbidden by rule: /var/www/html/xxx/
>
> Like to know your logformat for better understanding.
>
> For now it seems those PC are using HTTP/1.0, thus do NOT send a host header
> at all. Without a hostheader the default -first defined- vhost is
> responding.
>
> Most likely those PC fall back to HTTP/1.0 while using a proxy :
> Check under Tools -> Options -> Advanced
>
> HansH

do you use some rewrites for your customers which results in the host
being modified from
www.xxx.co.nz
to
www.xxx.co.nz/

that would appear to be non-standard.

and yes your log format suggests http/1.0 and the fact that your log
file doesnt record the host accurately suggests that you are setting
it using some rules in the httpd conf when http/1.0 is used over
proxies but getting it slightly wrong.

Re: Host with trailing slash

am 29.10.2007 21:43:23 von Russell Bell

I thought "host" was simply optional for HTTP 1.0 clients -
they can still send a host header if they want.

In this situation the client's website isn't the first vhost in
Vhosts.conf, it's in the middle of the file. So I think the
client PC must be sending a host header.

We don't have any rewrites in our config. Could I use a rewrite
to get rid of the trailing slash ? I'm not familiar with using
URL rewrites.

Russell

shimmyshack wrote:
> On Oct 27, 2:38 am, "HansH" wrote:
>> "Russell Bell" schreef in berichtnews:fftt9b$cdf$1@aioe.org...> We're hosting a website for customer using named virtual hosting,
>>> which works fine except for one problem. The customer says they
>>> can't access the website home page (www.xxx.co.nz)
>>> from certain PC's. The browser gets a "Directory index forbidden by rule"
>>> error.
>>> x.x.x.x [23/Oct/2007:13:29:40 +1300] "www.xxx.co.nz/"
>>> 398 "GET / HTTP/1.0" Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
>>> SV1; .NET CLR 1.1.4322)
>>> [Tue Oct 23 13:29:40 2007] [error] [client x.x.x.x]
>>> Directory index forbidden by rule: /var/www/html/xxx/
>> Like to know your logformat for better understanding.
>>
>> For now it seems those PC are using HTTP/1.0, thus do NOT send a host header
>> at all. Without a hostheader the default -first defined- vhost is
>> responding.
>>
>> Most likely those PC fall back to HTTP/1.0 while using a proxy :
>> Check under Tools -> Options -> Advanced
>>
>> HansH
>
> do you use some rewrites for your customers which results in the host
> being modified from
> www.xxx.co.nz
> to
> www.xxx.co.nz/
>
> that would appear to be non-standard.
>
> and yes your log format suggests http/1.0 and the fact that your log
> file doesnt record the host accurately suggests that you are setting
> it using some rules in the httpd conf when http/1.0 is used over
> proxies but getting it slightly wrong.
>