The whole process of entering the URL into the browser to return the page

Source: Internet
Author: User
Tags ack domain name server

The first step, resolve the domain name, locate the host IP

(1) The browser caches DNS for a period of time, typically ranging from 2-30 minutes. If there is a cache, return IP directly, otherwise next.

(2) The IP cannot be found in the cache, and the browser makes a system call to query the hosts file. If found, return IP directly, otherwise next. (In the computer local directory etc, there is a Hosts file, the Hosts file is saved with the domain name and IP correspondence resolution, often can also modify the hosts scientific Internet or cracked software. )

(3) carried out (1) (2) Local query no results, only with the help of the network. Routers generally have their own DNS cache, ISP service provider DNS cache, at this time generally can get the corresponding IP. If it is still fruitless, it can only be resolved with the help of DNS recursion.

(4) At this point, the ISP's DNS server starts the recursive search from the root name server, from the. com top-level domain name server to the Baidu domain name server.

Here, the browser obtains the IP. In the DNS parsing process, different IPs are often resolved. For example, the telecommunications is an IP, netcom is another IP. This is the result of taking the intelligent DNS, reducing inter-operator access latency, setting up the host room in multiple operators, and accessing the host nearby. Telecom users return to the host IP, netcom users return to the IP of the Netcom host. Of course, the hijacking of DNS, can also block out some of the network access, a fire wall has also added this feature.

Second, the browser establishes a TCP connection with the website

The browser uses IP to communicate directly with the website host. The browser issues TCP (SYN flag bit 1) connection request, the host returns TCP (Syn,ack flag bit is 1) Reply message, the browser received the reply message found ACK flag bit 1, indicating the connection request acknowledgement. The browser returns a TCP () acknowledgment message, the host receives a confirmation message, three handshake, and the TCP link is established.

The third part, the browser initiates a GET request

The browser initiates a Http-get method message request to the host. The request contains the URL of the access, which is http://www.baidu.com/, as well as the User-agent user's browser operating system information, encoding, etc. It is worth mentioning accep-encoding and cookies. Accept-encoding generally uses gzip, compressing and then transferring HTML files. Cookies if the first access, will prompt the server to establish user cache information, if not, you can use the cookie corresponding key value, find the corresponding cache, the cache contains the user name, password and some user settings.

Part IV, showing the page or returning other

Returns the status code of the OK, indicating that the server can request, return the message, because in the header content-type is "text/html", the browser is rendered in HTML, rather than download the file.

However, there are multiple host sites for large Web sites, which often do not return directly to the request page, but redirect. The returned status code is not a 301,302, but a redirect code starting with 3, the browser after the redirect response, the location item in the response message to find the redirect address, the browser re-first step access.

To add, redirect is to load balance or import traffic, improve SEO rankings. The use of a front-end server to accept requests, and then load to different hosts, can greatly improve the site's business concurrency processing capacity, redirection can also be multiple domain access, centralized to a site Because baidu.com,www.baidu.com will be considered by the search engine to be two sites, as each link number will be reduced thereby reducing the ranking, permanent redirection will be two addresses linked together, the search engine will be considered the same site, thereby improving the rankings.

The whole process of entering the URL into the browser to return the page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.