fbpx
Call us +1-231-421-7160

Resolving DNS & HTTP Redirect Issues

This article will explain what happens when a website name is entered into a browser's address bar and the "Enter" key is hit. For simplicity, this article won't cover all the aspects of Internet communication, but it will focus on basic communication between a client browser and an HTTP server.

What is Domain Name System (DNS)?

What is HTTP?

What is the relationship between DNS and HTTP?

References

What is Domain Names System (DNS)?

Basically, the purpose of DNS is to make human life in Internet easier. Computers on the Internet are finding each other using IP (Internet Protocol) addresses. It is a dotted number in form (e.g.: 11.22.33.44). The numbers are decimal values of one byte (0-255). It is very hard for us, as human beings, to use these addresses every time we want to reach a server on the Internet. That s why some wise guy (see references below) invented a system which converts these numbers into names and called it DNS. It is important to remember that the main task of a is not only to convert words to numbers, but also for finding hosts and services on the Internet in general.

What is HTTP?

HyperText Transfer Protocol (HTTP) was designed to retrieve resources on the World Wide Web . It is an application protocol which web browing software applications can understand.  To transfer data, HTTP is wrapped by a layer 4 protocol called "tcp" (see references below), and this is how a server responds to your query. In any browser, you will find that it has a field called "Address Bar".  The website address you type into the browser isn t actually an address, but a URL (Unified Resource Location). You should familiarize yourself with URLs and all their parts: protocol://host/query_string

  • We have many protocols, but we mainly use HTTP or HTTPS, which is a secured version of HTTP (see references below). 
  • A host can be a domain name or IP address. 
  • Query_string points to a file you want to retrieve, and it can also contain additional arguments for scripts.

Back to Top

What is the relation between DNS and HTTP?

After you type a URL into a browser, these actions are taken once you hit "Enter":

  1. resolve domain name to an IP address using DNS (host part)
  2. connect with host using tcp/ip protocol (depends on protocol part)
  3. send query and receive response using HTTP (query string)

If your browser has found a host to connect with, and successfully sent its query string, sometimes you can receive an HTTP redirect in response. An HTTP redirect is a special response header. Your browser recognizes it by reading an HTTP response code which is a number in the range or 300-304. A 301 code  means moved permanently .  The response header contains additional data relative to the code used. For 301, it is an URL.  This is where the magic occurs – after receiving a 301 redirect, most browsers won t ask you if you want to follow this redirect or not, they will just do it automatically for you. To follow a redirect, all of the actions described above are repeated but using a different URL.  This means that your browser will issue another DNS query, eventually make new tcp connection, and send the query obtained from a redirect to a server.

In real life, it is not that easy. When you type in your query you may receive results that you don t expect. When this happens, follow the steps below to find what is happening.

  1. Find the IP address for the domain you want to connect with.  An online resource like www.whois.net can help with finding an IP address.  Please notice that you should use the exact domain name as you type it into your browser (this is the host part of URL).

Windows

Press Start, Run, and type: cmd. At the command prompt, type: nslookup domain.com. Look for the IP address. Try to find out if it is an address you expected. If you don t know, ask someone who knows.*

Linux

Open terminal and use: dig domain.com or host domain.com. Look for the IP address. Try to find out if its address you expected. If you don t know ask someone who knows.*

  1. Observe what is going on in browser s address bar – is it changing somehow? E.g.: when you type in domain.com, does it change to to www.domain.com or something else?
  2. If something happens with the domain name or the query string it means your browser is receiving an HTTP redirect.
  3. Check if host part of URL has changed and if it does, check the IP address of new host.  Is it the one you want to connect to? Again, if you don t know ask someone who knows*
  4. These steps should provide you with enough knowledge to find out if your query was resolved properly in DNS and HTTP.

The following is a real-life example. We are having an issue with the following site: ace.nd.edu. The domain is hosted on oiur DNS, so there is no possibility of changing its records.  The administrator wants to have an obligatory redirection form ace.nd.edu to www.ace.nd.edu. To make this redirect, he has created redirection rules using mod_rewrite. After tha,t when you enter http://ace.nd.edu into a browser, it displays a redirection error (a page can t be displayed). What is happening?

It comes out that the domain name "ace.nd.edu" is pointing to our server s IP address, but the domain name www.ace.nd.edu is pointing to a different host. When you write www.ace.nd.edu into a browser you are connecting with a server on the World Wide Web which is not ours.  This causes a 301 redirect to ace.nd.edu. After resolving this redirect you will land on our server, which, in turn, sends you a 301 redirect to www.ace.nd.edu. Here we have a re-directions loop and the browser will display an error. How can we resolve this?

It depends on the client. If the client really wants this obligatory redirect, he must be taught how to change the DNS record for www.ace.nd.edu so it will point to our IP address. If the client doesn t care about his site name appearing in browser s address bar, just delete it and rewrite rules from the .htaccess file.

That s it! I hope this basic knowledge about resolving site names works in the global network. If you have any questions please ask me: This email address is being protected from spambots. You need JavaScript enabled to view it.

* ask system administrator – he/she will tell you where is pointing domain name you are asking for or will tell you if this domain name is hosted by us.

Back to Top

References

http://en.wikipedia.org/wiki/Paul_Mockapetris

http://en.wikipedia.org/wiki/Tim_Berners-Lee

http://en.wikipedia.org/wiki/Transmission_Control_Protocol

http://en.wikipedia.org/wiki/HTTPS

Do you have suggestions for improving this article?  

We take a great deal of pride in our knowledgebase and making sure that our content is complete, accurate and useable. If you have a suggestion for improving anything in this content, please let us know by filling out this form. Be sure to include the link to the article that you'd like to see improved. Thank you!