HTTP/HTTPS & TLS
HTTP/1.1 keep-alive and pipelining, request/response structure, TLS certificate chain validation, and HTTPS security model.
Overview
Overview HTTP (Hypertext Transfer Protocol) is the application-layer protocol that underpins the web and the vast majority of API communication in modern distributed systems. Understanding it deeply — beyond just knowing that GET fetches and POST creates — is essential for building reliable, performant, and secure services.
HTTP/1.1, standardized in RFC 7230-7235, introduced persistent connections (keep-alive) as the default, allowing multiple requests to reuse a single TCP connection. This eliminated the per-request TCP handshake overhead of HTTP/1.0. Pipelining extended this by allowing a client to send multiple requests without waiting for responses, though it suffered from head-of-line blocking at the response level and was never reliably implemented in practice.
An HTTP request consists of a method, request target (URI), HTTP version, headers, an optional body, and terminates with CRLF. The response contains a status line (version + status code + reason phrase), headers, and an optional body. Status codes carry semantic meaning: 1xx informational, 2xx success, 3xx redirection, 4xx client error, 5xx server error. Knowing which codes to use and what they imply for caching, retries, and client behavior is critical for API design.
TLS (Transport Layer Security) adds encryption, authentication, and integrity to HTTP, creating HTTPS. The TLS handshake occurs after TCP connection establishment and before any HTTP data flows. It negotiates cipher suites, authenticates the server (and optionally the client) via X.509 certificates, and establishes shared symmetric keys using asymmetric cryptography.
Certificate chain validation is a critical security mechanism. The browser or client must verify that the server's certificate was signed by an intermediate CA, which was in turn signed by a trusted root CA in the client's trust store. Certificate Transparency logs, OCSP stapling, and HSTS (HTTP Strict Transport Security) are additional layers of the modern HTTPS security model.
For SREs and backend engineers, understanding connection reuse, TLS session resumption, certificate rotation without downtime, cipher suite selection, and debugging TLS errors (certificate mismatch, chain validation failures, expired certificates) are daily operational concerns.
Key concepts
- HTTP Keep-Alive
- TLS Handshake
- Certificate Chain Validation
- HSTS (HTTP Strict Transport Security)
- OCSP Stapling
- mTLS (Mutual TLS)
Interview questions
- Describe the full sequence of events from when a user types https://example.com in their browser to when the first byte of HTML is received.
- How does TLS certificate chain validation work, and what are the failure modes you see in production?
- What is HSTS and how does it protect against downgrade attacks?
Sign up free to read the full topic
More Networking topics
Start free on Cariara · Coding problems · System design studio