This is a discussion on Server Name configuration??? within the Linux Web Servers forums, part of the Web Server and Related Forums category; Hello Gurus, I have a question about my hostname setup for my webserver and application server on my redhat 7....
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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/ |