← HTTPS, Packet by Packet
OSI Layer 7 · the application layer

Layer 7, up close

Layer 7 is where programs actually say things to each other: “give me this page”, “create this invoice”, “here is an email”. Everything below it exists to carry those messages. Tap a layer to see how it fits, then explore the top one.

TCP/IP: ApplicationTransportInternetLink
01

Anatomy of an HTTP exchange

HTTP is the most common Layer 7 protocol. Every exchange is a request and a response, each made of a start line, headers and an optional body. Tap any line to see what it does.

Request
Response

Methods: what the client wants

MethodUsed forSafeIdempotent
GETRead a resourceyesyes
HEADHeaders only, no bodyyesyes
POSTCreate, or run an actionnono
PUTReplace a resourcenoyes
PATCHChange part of a resourcenono
DELETERemove a resourcenoyes
OPTIONSAsk what is allowed (CORS)yesyes

Safe means it should not change anything. Idempotent means repeating it has the same effect as doing it once, which is what makes automatic retries safe.

Status codes: how it went

Tap a code.
02

Devices that work at Layer 7

Some network boxes only look at addresses and ports. Others read the HTTP itself and make decisions on it. Switch between the two kinds of load balancer and send a few requests.

Incoming requests
Back-end pools

reverse proxy

Reverse proxy

Sits in front of servers, ends TLS, and forwards requests. Adds headers, compresses, buffers slow clients.

e.g. nginx, HAProxy, Envoy
load balancer

L7 load balancer

Routes by hostname, path or header, checks server health, retries failed requests, and pins sessions with cookies.

e.g. AWS ALB, Google Cloud Load Balancing, Envoy
api gateway

API gateway

Front door for APIs: checks tokens, enforces rate limits and quotas, versions and reshapes requests.

e.g. Kong, Apigee, AWS API Gateway
waf

Web application firewall

Inspects requests for attack patterns such as SQL injection or known exploits, and blocks or challenges them.

e.g. Cloudflare WAF, AWS WAF, Coraza
cdn

CDN edge

Caches responses close to users and absorbs traffic floods before they reach the origin. Usually combines all of the above.

e.g. Cloudflare, Akamai, Fastly, CloudFront
sidecar

Service mesh proxy

A small proxy next to each service that adds mTLS, retries, timeouts and tracing to service-to-service calls.

e.g. Envoy in Istio, Linkerd proxy
03

Other Layer 7 protocols

HTTP is not alone at the top. Each of these solves a different conversation pattern. Pick one to see a real exchange.

04

Attacks at Layer 7, and how they are stopped

Layer 7 attacks look like normal requests, which is what makes them hard to stop. The first line of defense is often a rate limiter. Push the request rate up and watch it react.

Token bucket: holds 20 tokens, refills 10 per second, each request spends one. Short bursts pass; a sustained rate above 10/s gets 429 Too Many Requests.
Tokens in the bucket
Allowed (2xx)0
Rejected (429)0
Last 48 requests
Latest response headers

OWASP Top 10:2025, the most common web application risks

  1. Broken Access Control
  2. Security Misconfiguration
  3. Software Supply Chain Failures
  4. Cryptographic Failures
  5. Injection
  6. Insecure Design
  7. Authentication Failures
  8. Software or Data Integrity Failures
  9. Security Logging and Alerting Failures
  10. Mishandling of Exceptional Conditions

Most of these live in application code, not in the network. A WAF can catch some patterns, but it cannot know that invoice 124 belongs to someone else.