BASIC CONCEPTS - rs-hash/GETTHATJOB GitHub Wiki

1. What happens when you type google.com in your browser and hit enter?

1. DNS Lookup – Finding the Address

  • First, your browser checks its cache to see if it already knows the IP address for google.com.
  • If not, it asks the Operating System (OS), which:
    • Looks in the host file (local DNS entries).
    • Queries a DNS Resolver (usually your ISP).

The resolver follows this chain if it doesn’t have the answer:

  • Root Server β†’ Finds the TLD (Top Level Domain) Server for .com.
  • TLD Server β†’ Points to the Authoritative Name Server for google.com.
  • Name Server β†’ Returns the IP address (e.g., 142.250.183.206).

2. Browser Makes an HTTP Request

  • Once the browser has the IP address, it sends an HTTP GET request to the server.
  • The request includes:
  • The URL.
  • Cookies (session data).
  • Headers (browser details, accepted formats).

3. Establishing a Secure Connection (HTTPS)

  • If HTTPS is used, the browser:
  1. Requests the SSL/TLS certificate from the server.
  2. Verifies the certificate to ensure security and authenticity.
  3. Establishes an encrypted connection.

4. Server Handles the Request

  • The request reaches a load balancer, which distributes traffic to multiple servers to handle load.
  • A web server processes the request, often passing it to:
  • Application Servers for dynamic content.
  • Database Servers for storing and retrieving data.

5. Server Sends a Response

  • The server sends back:
  • HTML β†’ Structure of the page.
  • CSS β†’ Styling and layout.
  • JavaScript β†’ Interactive elements.

6. Rendering the Web Page

  • The browser:
  1. Parses the HTML and builds the DOM (Document Object Model).
  2. Applies CSS to style the DOM.
  3. Executes JavaScript to make the page interactive.
  4. Makes additional requests for images, videos, and fonts as needed.

7. Handling User Interaction

  • Scripts handle clicks, scrolls, and other inputs dynamically without refreshing the page (using AJAX calls).

β–Ί Key Technical Concepts You Should Know

  • DNS Caching speeds up repeated lookups.
  • TCP/IP Protocols ensure data is reliably sent and received.
  • HTTPS with SSL/TLS keeps communication encrypted and secure.
  • CDNs (Content Delivery Networks) speed up delivery of static assets like images and videos.
  • Firewalls and Security Checks protect against unauthorized requests.