Host with trailing slash

This is a discussion on Host with trailing slash within the Apache Web Server forums, part of the Web Server and Related Forums category; We're hosting a website for customer using named virtual hosting, which works fine except for one problem. The customer ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-27-2007
Russell Bell
 
Posts: n/a
Default Host with trailing slash

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:

<VirtualHost *:80>
ServerName xxx.co.nz
ServerAlias xxx.co.nz *.xxx.co.nz xxx.com *.xxx.com
DocumentRoot /var/www/html/xxx
DirectoryIndex /index.htm
</VirtualHost>
  #2 (permalink)  
Old 10-27-2007
HansH
 
Posts: n/a
Default Re: Host with trailing slash

"Russell Bell" <rb@fastbase.co.nz> 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






  #3 (permalink)  
Old 10-27-2007
shimmyshack
 
Posts: n/a
Default Re: Host with trailing slash

On Oct 27, 2:38 am, "HansH" <ha...@invalid.invalid> wrote:
> "Russell Bell" <r...@fastbase.co.nz> 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.

  #4 (permalink)  
Old 10-29-2007
Russell Bell
 
Posts: n/a
Default Re: Host with trailing slash


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" <ha...@invalid.invalid> wrote:
>> "Russell Bell" <r...@fastbase.co.nz> 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.
>

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:03 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0