NOTE

2.14 What Happens After Entering a URL in the Browser

Historical notes on the sequence of events after entering a URL in a browser.

Computer NetworksCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

1. Brief Process

Browser URL flow

  1. Parse the URL. For example, https://www.baidu.com or https://www.baidu.com/ -> https://www.baidu.com/index.html, while https://www.baidu.com/dir first checks whether there is a file named dir, and if not, checks for a directory.

  2. DNS domain-name resolution.
    DNS

  3. Establish a TCP connection with a three-way handshake.
    TCP Three-Way Handshake
    ARP
    IP Protocol

  4. If it is HTTPS, establish an HTTPS connection as well.
    HTTPS

  5. After the TCP connection is established, generate an HTTP Request to request the HTML.
    HTTP Message Format.md

  6. The server returns an HTTP Response and the browser obtains the HTML code.

  7. The browser parses the HTML and requests resources referenced by the HTML, such as JS, CSS, and images.

  8. Request API data according to the JavaScript.

  9. Nginx receives the request and forwards it to the upstream API gateway. The API gateway forwards it to the upstream server. The upstream server checks Ehcache, Redis, and the database, and the result is returned step by step.

  10. The browser renders the page and presents it to the user.

  11. Close the connection with the TCP four-way teardown.
    TCP Four-Way Teardown

2. References

Discussion

Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub