12 04 | 2012

Why “www.”?

Written by Tanguy

Classified in : Homepage, Debian, To remember

Three big “W”s in shades of green

Many websites have addresses that use a www.- prefix. Some people are encouraging this practice, other are advising against it.

I, for one, think this prefix makes sense and is really useful, so here is an explanation of my opinion. In a nutshell: the Wold Wide Web is one Internet service among many other such as domain name, mail, mailboxes or instant messenging; using a dedicated prefix allows to distribute all these services to specific servers in a convenient way.

On Internet, you can expose several services, the most common being domain names (DNS), websites (HTTP), incoming mail (SMTP), outgoing mail submission (submission), mailbox fetching (POP) or consultating (IMAP) and instant messenging (XMPP).

Constraints

Modern Internet services can have constraints such as load balancing, failover and most importantly the possibility to use specific servers for each service instead of having all of them on the same server.

Dedicated records

Some service were designed or revised to take these contraints into account; this include the domain name, incoming mail and instant messenging, by using dedicated DNS records:

example.com.                    NS              roquefort.example.com.
example.com.                    MX  10          morbier.example.com.
_xmpp-server._tcp.example.com.  SRV 10 100 5269 morbier.example.com.

In that example, the name service of example.com. is provided by the server Roquefort while the incoming mail and instant messenging service are provided by Morbier

Dedicated prefixes

On the contrary, some services were not designed to take these constraint into account, and may be too fossilized to be revised for that; this includes the Web and mailbox service. A convenient way to work around the antiquated design of these services is to use a well known prefix:

www.example.com.                CNAME           ossau-iraty.example.com.
smtp.example.com.               CNAME           morbier.example.com.
pop.example.com.                CNAME           morbier.example.com.
imap.example.com.               CNAME           morbier.example.com.

In that example, the Web service of example.com. is provided by the server Ossay-Iraty while the email submission and mailbox services are provided by Morbier.

Readability and flexibility

Using dedicated records and prefixes increases the consistency and readability of a DNS zone, since it allows to refer to the servers by their canonical host name, and to define their IP addresses once and for all:

; Services
example.com.                    NS              roquefort.example.com.
example.com.                    MX  10          morbier.example.com.
pop.example.com.                CNAME           morbier.example.com.
imap.example.com.               CNAME           morbier.example.com.
www.example.com.                CNAME           ossau-iraty.example.com.

; Hosts
roquefort.example.com.          A               192.2.0.12
                                AAAA            2001:db8::12
morbier.example.com             A               192.2.0.42
                                AAAA            2001:db8::42
ossau-iraty.example.com.        A               192.2.0.51
                                AAAA            2001:db8::51

You can think of that practice as connecting dots between services and hosts:

name service  •────────────────────→• Roquefort
incoming mail •────────┬───────────→• Morbier
mailboxes     •────────╯ ╭─────────→• Ossau-Iraty
website       •──────────╯

With such a DNS zone, it is very easy to identify which server is hosting each service. Using host names rather than IP addresses multiple times reduces the information duplication, which in turn facilitates future chances and reduces the risk of error (it is easier to swith the website from Ossay-Iraty to Morbier than from 192.2.0.51/2001:db8::51 to 192.2.0.42/2001:db8::42).

9 comments

friday 13 april 2012 à 00:41 Iñigo said : #1

As soon as authoritative name servers are called ns1.example.com, ns2.example.com, ns3.etc I do not see a problem considering the "no subdomain" as the web service.

how people implements high availability with DNS? ns1, ns2, ns3 etc as NS entries. Clients will failover in all Operative system.

how people implements high availability with HTTP services? well, virtual IPs, HAproxy, ucarp, etc. Clients will not jump to "next DNS entry" if first one fails.

The main issue around using or not using the www prefix, is: consistency. Cookies, ssl, etc... IMHO it's a "pick one" issue.

Nice post. Greetings.

friday 13 april 2012 à 02:19 calestyo said : #2

There's not really much reason in using subdomains like www/ftp etc. if there's only on server in a domain (or if the respective daemons run on one server).

To differenciate between services, you have port numbers on TCP/UDP level and schemas on URI level.

friday 13 april 2012 à 02:59 www.www.www.com.com.com said : #3

Obligatory: http://no-www.org/

friday 13 april 2012 à 08:45 Tanguy said : #4

@Iñigo : That kind of high availability is useful, but is still a workaround. With services with an up-to-date design such as SMTP or XMPP, anyone can very easily implement a complete fail-over service. With the antiquated design of HTTP, the lack of such a mechanism can be worked around, but only partially: since it uses a single IP address (one can have serveral AAAA or A records, but this is for load balancing, not for fail-over) it will always have a single point of failure, usually the Internet service provider, or the BGP service for fortunate people that can have their own AS.

@calestyo : Yes, that is true, with only one server there is no technical reason for using a prefix… until you choose to use an additional server and have to move all that to using a prefix. And even with one server, it still allows for a cleaner DNS zone, with each service referencing the canonical name of the (possibly single) server implementing it.

sunday 15 april 2012 à 17:36 mirabilos said : #5

CNAME considered harmful. Do not use it.

monday 16 april 2012 à 10:08 Tanguy said : #6

@mirabilos : Wow, that is what I call argumenting… Sorry if I do not consider your comment worth taking into account.

Now, since at least I, for one, am capable of argumenting, I can explain a bit. For me, a CNAME is like a symlink in a file system: a good way to make an entity available with several names, while keeping one of these names as the canonical one which is refered to by the symbolic ones. This is essential for coherence and manageability, but it comes with a cost: it doubles the initial time to resolve a symbolic name, although it changes nothing most of the time thanks to caching.

monday 16 april 2012 à 22:14 Quimby said : #7

I just hate it, when websites are not accessible without the "www". twitter makes it right by completely getting rid of it. How much time is wasted every day by people typing "www"? Must be worth millions. (I see this from a user's standpoint obviously.)

tuesday 17 april 2012 à 01:54 rjc said : #8

There are several issues involved. I can see your argument for having www prefix for consistency with other services, i.e. pop, imap, etc.

Here's a question however: How many times a day do you enter pop/imap/ns1/whatever into your email client, network setup, etc. I'll answer that for you: none. You've entered them once and they're static.

Here's another quesion: How many websites do you visit daily? Probably dozens. Entering "www.", four unnecessay characters, for every single one of them, every day? Too much time wasted if you ask me.

monday 23 april 2012 à 09:13 Antoun Sehnaoui said : #9

Hello,
I used to believe that all the websites online began with the prefix "www". I'm glad to learn more about this subject though it's still a bit too technical for me. Thank you for sharing this!

Write a comment

What is the third letter of the word olrrv? : 

Archives