Web Servers on Unix and Linux - Server Name configuration???

This is Interesting: Free IT Magazines  
Home > Archive > Web Servers on Unix and Linux > August 2004 > Server Name configuration???





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Server Name configuration???
Chow

2004-08-11, 2:49 am

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

for say in a simple web page when we have two links to the above
two urls both resolve to

http://hostname/sampleuri/test.html ( assuming http://hostname is
where the request came from in the second case).

I want to know if we have to configure something in the system
properties in the OS like in /etc/hosts file or somewhere to do that.

I want to know how the browser actually get the hostname part of
the complete URL in the second case (Relative URL) and forms a
qualified URL to the resource. Please check the below url for my
question ( See the source of the file if you want to see the HTML
code)

http://www.geocities.com/cnadella/

http://geocities.com/cnadella/

Observe the second url's full path to see the difference for above
two request URLs.

I really don't if it is a system level configuration or a
webserver/application server level configuration. Please help me
understand this if anybody knows about it.

Thanks a lot in advance.


Cheer,

Nadella
David Efflandt

2004-08-13, 7:48 am

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/
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com