08-13-04 12:48 PM
On 10 Aug 2004 20:31:40 -0700, Chow <cnadella@excite.com> wrote:
> Hello Gurus,
>
> I have a question about my hostname setup for my webserver and
> application server on my redhat 7.2 linux machine with Apache HTTPD
> server 1.3 version.
>
> I want to understand how actually browser resolves the hostname
> part of the request url when a request is posted. For example we have
> two url's,
>
> One is absolute URL,
>
> http://hostname/sampleuri/test.html
>
> and other is relative URL,
>
> /sampleuri/test.html
I believe that would be called a full (or absolute) URI, not relative. In
this case the full URL is constructed by the browser based on the hostname
used to access the page (or meta base href tag, if there is one).
A "relative" URI would not begin with "/". Relative would be relative to
current path, for example "test.html" from anything in
http://hostname/sampleuri/ would point to
http://hostname/sampleuri/test.html, or "otherdir/test.html" would point
to http://hostname/sampleuri/otherdir/test.html. And a link to
"test2.html" from that last path would point to
http://hostname/sampleuri/otherdir.test2.html
One gotcha is if the server redirects the request using its ServerName
instead of the browser's Host header (especially if the browser cannot
resolve that set or assumed ServerName). See apache docs for
UseCanonicalName.
As long as you have UseCanonicalName off, the set ServerName or hostname
of the machine usually does not matter. However, in my case I
specifically set a bogus Servername (along with UseCanonicalName off), so
any Host requests other than ServerName or ServerAlias for my set virtual
hosts go to my default name based virtual host (worm trap), because
otherwise the virtual host that matched my real hostname would not work
properly.
--
David Efflandt - All spam ignored http://www.de-srv.com/
[ Post a follow-up to this message ]
|