- The Zen of Serving Web Pages - The Connection between Browser and Server

The Zen of Serving Web Pages

Web Server Know How © 2003 Christian Treber

The Connection between Browser and Server

Christian Treber, Senior IT Consultant and Internet Services Specialist

When you want to surf a web site, you start the browser, type in an URL (or select a book mark), and the browser fetches and displays the requested page.

Behind the scenes a number of things are happening. It all starts with you entering or selecting an URL, in example "". If you just type in "", the browser automatically creates the complete address for you.

The browser analyses the URL by braking it down in three parts.

Protocol. The word before the colon is the protocol, in our case "http". That's an acronym for the HyperText Transfer Protocol, which is the language of the World Wide Web. "ftp:" would mean you're trying to access a file server using the File Transfer Protocol.

Address. The next section, after the double slashes, is the Internet Protocol address, or IP address for short. "" is the name of the server we're trying to contact. The dots separate different parts of the address. The last part, "com" (which stands for "commercial"), is the top level domain or TLD. Everything but the first part is the domain, in our case "". Within this domain (aka network) the host "www" has been selected.

Path. The section after the IP address specifies the path to the file that is to be fetched. If the path points to a directory, the server return the default document in this directory, most often "index.html" or "default.htm".

The browser now knows which IP address to contact (""), which protocol to use ("http"), and which file to ask for ("/").

The HTTP protocol actually uses, like most Internet protocols, plain text for the conversation (good for us). The browser might send something like this to the web server:

GET / HTTP/1.0
GET / HTTP/1.1
connection: close

In the first case HTTP version 1.0 is used, in the second case version 1.1. The command is "GET" for retrieving the page, the URL is "/", and the protocol and version follow. HTTP/1.1. requires/allows some extra options, in our example the name of the host requested ("") and the request to close the connection after the response has been sent.

The server receives the request and responds with the requested page, or an error message if something goes wrong. In our case everything goes well, and the response might look like this:

HTTP/1.1 200 OK
Date: Fri, 29 Nov 2002 08:59:29 GMT
Server: Apache/1.3.20 (Linux/SuSE)
Content-Location: index.html.en
Vary: negotiate,accept-language
TCN: choice
Connection: close
Content-Type: text/html
Content-Language: en
Expires: Fri, 29 Nov 2002 08:59:29 GMT

[Document follows, connection is closed]

The server tells us which protocol and version it is using, and gives us the result code "200 OK". What follows is some more information regarding the document served.

If the browser detects in exampe images in the document, it automatically starts loading the images as well. This implies loading one web page can cause dozens of additional requests for images, style sheets, frames, and other embedded objects.

© 2003 Christian Treber,

Back to main page.