FOUNDATIONS / SYSTEM CONCEPT BRIEF

Proxies

A proxy is an intermediary that sits between clients and servers and forwards traffic on someone's behalf.

BeginnerPhase 01 / Topic 9 of 17RequirementsTrade-offsFailure modes
01

Overview

A proxy is an intermediary that sits between clients and servers and forwards traffic on someone's behalf. A forward proxy acts for clients: it controls and hides outbound traffic from a company network. A reverse proxy acts for servers: it receives incoming traffic and forwards it to backend servers, hiding their details from the internet.

Proxies are how large systems add cross-cutting capabilities without changing application code: caching, TLS termination, authentication, rate limiting, logging, and compression. Load balancers, API gateways, CDNs, and service mesh sidecars are all specialized proxies.

A personal assistant vs a company receptionist

A forward proxy is your personal assistant who makes calls for you, so the other side sees the assistant, not you. A reverse proxy is a company receptionist who answers all incoming calls and routes them to the right employee, who stays hidden behind the front desk.

02

When to use it

  • Controlling or filtering outbound traffic from a corporate network (forward proxy).
  • Hiding and protecting backend servers (reverse proxy).
  • Adding caching, compression, TLS, or auth in one place.
  • Routing requests to different services by path or host.
03

Where it shows up in interviews

Edge layer

Recognize it when: a single entry point for many backend services.

  • Design an API gateway
  • Design a CDN
Egress control

Recognize it when: servers must call external APIs through a controlled path.

  • Design a secure outbound integration platform
  • Design a web crawler
04

Where it is used in real software

Corporate forward proxies

Companies route employee web traffic through proxies like Zscaler or Squid for filtering, logging, and data-loss prevention.

Reverse proxies

Nginx, HAProxy, Envoy, and Traefik front web applications; Cloudflare is a global reverse proxy.

Service mesh

Istio and Linkerd run a sidecar proxy next to every service to handle retries, mTLS, and metrics.

05

Key terms

Forward proxy
Configured by the client; represents clients to servers.
Reverse proxy
Configured by the server owner; represents servers to clients.
Transparent proxy
Intercepts traffic without client configuration.
Sidecar
A proxy deployed alongside each service instance.
06

How it works, step by step

  1. 1
    Client sends a request

    To the proxy's address (reverse) or through the configured proxy (forward).

  2. 2
    Proxy applies policy

    Authentication, filtering, rate limits, or cache lookup.

  3. 3
    Proxy forwards

    Opens or reuses a connection to the target server.

  4. 4
    Proxy processes the response

    Caches, compresses, rewrites headers, and logs.

  5. 5
    Proxy returns the response

    The client never talks directly to the other side.

07

Forward vs reverse proxy

Same mechanism, different owner and purpose

Step 1 / 5
AspectForward proxyReverse proxy
Acts on behalf ofClientsServers
Configured byClient or corporate ITService owner
HidesClient identityBackend servers
Typical featuresFiltering, anonymity, egress loggingLoad balancing, TLS, caching, WAF
ExamplesSquid, ZscalerNginx, Envoy, Cloudflare

NOWAspect: Acts on behalf of | Forward proxy: Clients | Reverse proxy: Servers

If the proxy is between your users and the internet, it is forward. If it is between the internet and your servers, it is reverse.

08

Implementation

# Send a request through a forward proxycurl -x http://proxy.corp.example:3128 https://api.partner.com/status # Many tools respect proxy environment variablesexport HTTPS_PROXY=http://proxy.corp.example:3128export NO_PROXY=localhost,.internal.example   # bypass for internal hosts
09

Complexity and performance

Added latency~0.1-1 ms

In the same data center.

Connections2 per request path

Client-proxy and proxy-server (often pooled).

10

Trade-offs

Central control vs single point of failure

Proxies centralize policy but must be redundant and scaled, or they become a bottleneck.

Visibility vs privacy

TLS-intercepting proxies can inspect encrypted traffic but require trusting a corporate certificate on every device.

11

Variants and related techniques

Load balancer

A reverse proxy specialized in distributing traffic.

API gateway

A reverse proxy with API-aware features: auth, quotas, versioning.

CDN

A globally distributed caching reverse proxy.

12

Common mistakes

  • Losing the client IP.

    Fix: Configure X-Forwarded-For or the PROXY protocol, and trust it only from your proxies.

  • Proxy timeouts shorter than backend work.

    Fix: Align timeouts across layers to avoid 504s for long requests.

13

Interview questions

What is the difference between a forward and a reverse proxy?

A forward proxy represents clients (for filtering, anonymity, egress control). A reverse proxy represents servers (for load balancing, TLS termination, caching, and protecting backends).

Why put a reverse proxy in front of an app server?

To terminate TLS, serve static files, compress, buffer slow clients, rate limit, and hide and balance multiple app instances.

14

Practice problems

ProblemDifficultyWhat it trains
Draw where forward and reverse proxies sit in a company networkEasyPlacement.
Design egress control for servers calling third-party APIsMediumForward proxy policy.