# Low Level Design: Reverse Proxy

Source: https://www.techinterview.org/post/3233471159/lld-reverse-proxy/
Updated: 2026-04-18 · techinterview.org

## Core Functions

A reverse proxy sits between clients and upstream servers, providing: TLS termination, request routing, upstream connection pooling, response caching, compression, rate limiting, and DDoS mitigation.

## TLS Termination

The proxy decrypts incoming TLS and forwards plain HTTP to upstreams. Certificates rotate without downtime via SNI — multiple certs loaded simultaneously; the correct one selected per hostname at handshake time.

## HTTP/2 to HTTP/1.1 Translation

Client HTTP/2 streams are multiplexed over a single connection. The proxy fans these out to upstream HTTP/1.1 connections drawn from a per-upstream pool, bridging protocol versions transparently.

## Connection Pool


```
Per-upstream pool:
  max_connections = 100
  idle_timeout    = 60s
  health_check    = TCP connect every 10s on idle connections
```

Connection reuse eliminates per-request TCP and TLS handshake overhead to upstreams.

## Request Buffering

The proxy buffers the complete request body before forwarding to the upstream. This decouples slow clients from upstream workers, preventing slow-loris-style resource exhaustion.

## Response Streaming

Large responses are streamed directly to the client without full buffering at the proxy, reducing Time to First Byte (TTFB) and memory pressure.

## Compression

Gzip and Brotli compression applied when the client sends `Accept-Encoding` and the response content type is compressible (`text/html`, `application/json`, etc.). Skipped for already-compressed formats (images, video).

## DDoS Mitigation

  - Rate limit by IP + User-Agent combination.

  - Redirect suspicious traffic to a CAPTCHA challenge page.

  - Block known bad IPs via a continuously updated IP blocklist.

## Header Manipulation

The proxy can add, remove, or rewrite both request headers (before forwarding) and response headers (before returning to client). Common uses: inject `X-Request-ID`, strip internal headers, set `Strict-Transport-Security`.

## Web Application Firewall

Requests are inspected for SQLi, XSS, and other OWASP Top 10 patterns before forwarding. Matched requests are blocked or flagged for logging.

See also: [Netflix Interview Guide 2026: Streaming Architecture, Recommendation Systems, and Engineering Excellence](https://www.techinterview.org/post/3233460274/netflix-interview-guide-2026-streaming-architecture-recommendation-systems-and-engineering-excellence/)

See also: [Scale AI Interview Guide 2026: Data Infrastructure, RLHF Pipelines, and ML Engineering](https://www.techinterview.org/post/3233460275/scale-ai-interview-guide-2026-data-infrastructure-rlhf-pipelines-and-ml-engineering/)

See also: [Anthropic Interview Guide 2026: Process, Questions, and AI Safety](https://www.techinterview.org/?p=3233460282)
