What is the network layer under HTTP?
HTTP rides on top of lower layers you rarely see but always depend on. TCP makes sure bytes arrive in order, IP routes them across networks, and TLS encrypts them. Understanding this stack explains timeouts, dropped connections, and why HTTPS needs a certificate.
Why it matters
When a request hangs or fails intermittently, the bug is often below your application: a connection limit, a slow TLS handshake, or a load balancer health check. Backend engineers who can reason about the network resolve these fast. It also underpins every scaling decision you will make later.
What to learn
- The layers: IP, TCP, and where HTTP and TLS sit
- TCP handshake, connections, and keep-alive
- Ports, sockets, and the listen backlog
- TLS in plain terms: certificates, handshake, and HTTPS
- What a reverse proxy and a load balancer each do
- Latency vs bandwidth, and round trips
- Timeouts and retries at the connection level
Common pitfall
Ignoring connection reuse. Opening a fresh TCP and TLS connection for every outbound request is slow and exhausts ports under load. Use keep-alive and connection pooling for database and HTTP clients, or a busy service will stall on handshakes it did not need to make.
Resources
Primary (free):
- Cloudflare — What is TCP/IP? · docs
- Cloudflare — What is TLS? · docs
- Cloudflare — What is a reverse proxy? · docs
Practice
Use curl -v https://example.com and read the verbose output: find the TCP
connection, the TLS handshake, the certificate, and the HTTP exchange. Then run
it again with --http1.1 and compare. Done when you can point to each phase
and say what it cost in time.
Outcomes
- Explain where TCP, IP, TLS, and HTTP sit relative to each other.
- Describe what a TLS handshake does and why HTTPS needs a certificate.
- Say what a reverse proxy and load balancer add in front of a service.
- Justify connection pooling using the cost of a handshake.