[Gllug] HTTP CONNECT

Tethys tet at accucard.com
Fri Oct 11 08:46:29 UTC 2002


Pete Ryland writes:

>On Thu, Oct 10, 2002 at 08:10:29PM +0100, Dean Wilson wrote:
>> Something else to test while you are doing this is to try and do a "GET
>> http://www.google.com/ HTTP/1.0" (Someone correct me if the get syntax is
>> wrong, I'm not sure if the / on the end of the URL is needed) followed by
>
>If you don't put the trailing slash, it will redirect you to that anyway, so
>even when browsing normally (on a latency-bound link) it's faster to type
>the trailing slash than to wait for the redirect.

Actually, I think you'll find that for the site root, you don't need the
trailing slash, but it's definitely faster for subdirectories. I.e., the
following should be treated the same:

	http://www.google.com/
	http://www.google.com

while the first of these will be faster than the second:

	http://www.google.com/news/
	http://www.google.com/news

This is because the browser will just do a "GET /" for the main site,
whether it has the trailing / or not. But for a subdirectory it'll ask
for exactly what you specified in the URL. What I don't understand is
why Apache returns a 301 when you omit the trailing slash, rather than
just Doing The Right Thing. It hasn't moved permanently -- it was never
there in the first place[1]. Maybe this could be handled with a rewrite
rule (although can you conditionally rewrite only if the requested file
is a directory?), but I'd have thought it should be the default behaviour
for the server anyway, rather than relying on the site admin setting up a
rewrite rule.

Tet

[1] IIS returns a 302 Object Moved, which if anything is worse, since it
    implies that it might return again at some point...

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list