4

Some domain registry like europeregistry.com allows users to buy and register a domain and set up a "redirection" to an existing website.

Is this redirection a function of DNS or has the registry setup a behind-the-scenes webserver that does a HTTP redirection to the specified website?

Jake
  • 1,172
  • 6
  • 28
  • 48
  • This can be confirmed using a network sniffer like tcpdump or wireshark. Just run it and request your website and see if you are getting any HTTP redirect responses. – Khaled Apr 24 '12 at 09:30
  • For that matter, do something like `curl -Iv http://redirected.example.com` and you'll see the connection to the IP address of the redirection provider run by the DNS service, followed by a 301 to whatever that is set to point at. Obviously, this only works with HTTP requests, but that may be all you care about. – cjc Apr 24 '12 at 09:48

3 Answers3

7

How about this for a complete answer:

DNS has the concept of a CNAME record, where an entry can point to a different entry, as per adaptr's answer. So, a DNS lookup of "redirect.example.com" will return a CNAME that says "example.hostingservice.com", which will subsequently be looked up to some A record with an IP address (with perhaps more levels, if the target of a CNAME is also a CNAME, etc.) This is a standard part of DNS.

Some DNS providers, but not all, will let you create a non-standard "HTTP redirect" record. For example: http://help.dnsmadeeasy.com/record-entry/http-redirection/

This non-standard record appears to be what the OP refers to, and is geared towards hosted web sites, where it may not be possible to set up custom domains to your liking. What happens is that the "HTTP Redirection" record let's you map the website http://redirect.example.com to something like http://example.hostingservice.com. The DNS for "redirect.example.com" actually resolves to a server run by that DNS provider. That server runs a specialized web server, that will issue an HTTP redirect so that the browser goes from http://redirect.example.com to http://example.hostingservice.com.

A couple things get mixed up in this: there's a DNS query that resolves to a machine controlled by the DNS provider. There is an HTTP response from that machine's web server which sends people off to a different web server. This is not purely DNS, and, in fact, only works for web services because of the HTTP redirect. You can't use this for, say, mail. This is entirely for people who don't want to (or can't) set up their own web server to issue the HTTP redirect themselves. My example would be, say, an expensive SSL certificate for a custom domain on Heroku. Instead of paying for that, the DNS provider can give us a "HTTP redirect" record for an easy-to-remember hostname. Hitting that easy-to-remember hostname in a web browser will send us to the hard-to-remember Heroku server running SSL.

cjc
  • 24,916
  • 3
  • 51
  • 70
  • 1
    Indeed. And the full reality is a bit too dense for a simple SF Q&A session - it requires knowledge spread across half a dozen fields. – adaptr Apr 24 '12 at 14:16
  • +1 thanks for the full explanation, but I personally preferred Mark's answer. – Jake Apr 25 '12 at 01:11
6

It's a behind-the-scenes thing that they do. They will register the domain, point it to their own webservers, and have very simple script that checks the incoming domain, looks it up in its database to see which site it should redirect to, and gives you a 301/302 redirect.

So it's actually three different things all working together.

adaptr
  • 16,576
  • 23
  • 34
Mark Henderson
  • 68,823
  • 31
  • 180
  • 259
  • ...no. Where did HTTP come in ? – adaptr Apr 24 '12 at 09:30
  • Yes, actually. This is a particular service with some DNS providers. It's for people who don't want to (or can't) muck with their own web servers to do the 301. For example, we have a bunch of internal sites that run on Heroku, but we don't feel like paying for the "SSL on custom domain names". So, we set up simple names with the DNS provider to do the HTTP redirect to the Heroku URL. Look at http://help.dnsmadeeasy.com/record-entry/http-redirection/ – cjc Apr 24 '12 at 09:57
  • 1
    ...no. refers to the fact that in the above answer, HTTP suddenly appears from nowhere. That's not an explanation. – adaptr Apr 24 '12 at 11:44
  • @adaptr ... so you want me to into the detail of how how a nameserver relates to HTTP? I figured that kind of wasn't necessary for the average person... – Mark Henderson Apr 24 '12 at 11:48
  • 1
    It was necessary for the OP. – adaptr Apr 24 '12 at 12:01
  • 1
    I don't think it was at all: "or has the registry setup a behind-the-scenes webserver that does a HTTP redirection to the specified website?" Clearly he understood where the 301/302 would come from, as he described the setup in the question itself. – gparent Apr 24 '12 at 14:06
  • Seems like there's a bit of heat here. I think I prefer Mark's answer because it is simplest to understand. I can google for 301/302 redirect and find out how it works. Thanks. – Jake Apr 25 '12 at 01:15
0

When talking about pure DNS, they are referring to a CNAME record; a CNAME points to another label, which has to be resolved anew (hence "redirection") by the client.

Example:

yoursite.example.com. IN CNAME www.example.org.

www.example.org. IN A 10.10.10.10

There are both pros and cons to using CNAMEs; primarily, it forces a second lookup.

adaptr
  • 16,576
  • 23
  • 34