Reverse Proxy Interview & Revision
Core reverse-proxy questions, framed for reasoning rather than memorisation. Build answers by evolution — start from direct access and introduce the proxy one problem at a time — then use the quiz and cheat sheet to lock in the distinctions.
Interview Questions
A strong answer does not stop at a memorised definition — it reasons from a problem to the proxy and distinguishes that proxy cleanly from a load balancer and an API gateway.
The core four
What is a reverse proxy?
A server in front of your application servers that receives every client request on their behalf and forwards it to the right backend, then relays the response. Clients only ever see the proxy. Build the answer up: it's the single edge layer where SSL, static serving, routing, caching, and security live so the backends don't each own them.
Why do companies use Nginx?
Because one Nginx tier solves several problems at once: it terminates HTTPS (one cert surface instead of one per server), serves static files efficiently, routes multiple services under one domain, caches safe responses, and filters hostile traffic — and it can also balance across backends when needed. Answer by walking the problems it removes from the app, not by listing directives.
Reverse proxy vs load balancer?
Both can spread traffic across backends, but a load balancer is narrow and distribution-first, while a reverse proxy is the public-facing HTTP(S) intermediary that can also terminate TLS, cache, serve static, route by path or host, and apply security controls. They're complementary: in production a dedicated LB often sits in front of a cluster of reverse proxies.
Reverse proxy vs API gateway?
An API gateway is a reverse-proxy-based layer specialised for APIs and policy: auth, per-consumer rate limiting, aggregation, transformation, and versioning. A reverse proxy may also route to multiple backends, but its centre of gravity is general edge plumbing for HTTP(S) traffic. Same underlying tech, different responsibilities.
Follow-ups that expose whether the model is solid
Forward proxy vs reverse proxy?
Direction and beneficiary. A forward proxy sits in front of clients and proxies their outbound traffic (the destination server usually does not care that it is there). A reverse proxy sits in front of servers and proxies inbound traffic on their behalf (the client usually only sees the proxy's address). Remember it by who it fronts.
What does SSL termination mean?
The client negotiates HTTPS with the proxy; the public certificate typically lives on the proxy tier, and the proxy→backend hop may be plain HTTP on a trusted network or HTTPS again if you re-encrypt internally. One public cert surface to rotate instead of one per server.
How does proxy caching help?
On a cache hit within the TTL the proxy answers without touching the backend; a miss falls through, then populates the cache. At a high hit ratio the backend sees only a fraction of total traffic. The catch: never cache per-user content under a shared key.
How does a reverse proxy improve security?
Backends have no public address, so the internet can't reach them directly — the proxy is the only exposed surface. Being the single choke point, it's where you enforce TLS, rate limiting, IP filtering, request limits, and WAF rules, dropping bad requests before any app parses them.
How do you make the proxy highly available?
Avoid running just one in production — it's on every request. Run a cluster of identical, stateless proxies behind a dedicated load balancer with health checks, so a failed instance is ejected automatically and the tier scales horizontally.
Where does path-based routing fit?
The proxy forwards by host or URL prefix — /api to the API service, /admin to admin, /static to assets — presenting one domain over several independent backends. This overlaps with API-gateway routing, but without assuming the full API-policy layer.
Why serve static files from the proxy?
Static files never change per request, so making an application runtime generate them wastes CPU. The proxy streams them directly from disk or cache and bypasses the backend entirely, freeing the app for dynamic work.
Revision Notes
The whole module compressed to what you must be able to recall cold.
- 01A reverse proxy sits in front of servers, receives every request, and forwards to the right backend — clients only see the proxy.
- 02Forward proxy fronts clients (outbound); reverse proxy fronts servers (inbound).
- 03It bundles five edge jobs: SSL termination, static serving, path routing, caching, and security.
- 04SSL termination = one public cert surface at the proxy; the backend hop is plain HTTP on a trusted network unless you re-encrypt it.
- 05Static files are served straight from the proxy's disk, bypassing the backend.
- 06Path routing puts many services (/api, /admin, /static) under one domain.
- 07Cache hit = answered by the proxy, backend untouched; never share-cache per-user content.
- 08Security: backends are private and unreachable; the proxy blocks bad traffic at the edge.
- 09Reverse proxy vs load balancer: broad-and-smart vs narrow-and-fast; used together.
- 10Reverse proxy vs API gateway: a gateway builds on proxy behaviour and adds API policy such as auth, quotas, aggregation, and versioning.
- 11HA = a stateless proxy cluster behind a load balancer; no single point of failure.
- 12Reference architecture: Internet → (CDN →) Load Balancer → Reverse Proxy Cluster → Backends.
Quiz
Answer each out loud before expanding your mental model. If you can explain the why, you're ready.
Q1 · A reverse proxy and a forward proxy differ how?
By who they front. Forward proxy: in front of clients, proxies their outbound requests, server unaware. Reverse proxy: in front of servers, proxies inbound requests on their behalf, client unaware.
Q2 · With SSL termination, is proxy→backend traffic encrypted?
Often no — HTTPS terminates at the proxy and the internal hop is plain HTTP over a trusted network. In zero-trust environments you re-encrypt that hop (e.g. mTLS).
Q3 · When is a cache slower than no cache?
On a miss: you pay the cache lookup plus the full backend fetch. Caches only win when hits dominate — always measure hit ratio.
Q4 · Why isn't a reverse proxy just a load balancer?
Load balancing is one of its jobs. It also terminates SSL, serves static, routes by path, caches, and filters. A dedicated LB is deliberately narrow and fast; the proxy is broad and application-aware.
Q5 · How does it differ from an API gateway?
A gateway usually builds on reverse-proxy behaviour, then adds API policy such as auth, per-consumer rate limiting, aggregation, transformation, and versioning.
Q6 · Why is a single reverse proxy dangerous?
It's on every request, so it's a single point of failure — if it dies, SSL, routing, and cache all die with it. Run a cluster behind a load balancer.
Q7 · Why serve static files from the proxy instead of the app?
A compiled proxy streams files from disk far faster and cheaper than a language runtime, and it bypasses the backend entirely, freeing it for dynamic work.
Cheat Sheet
The whole module on one screen — skim it right before you walk in.
REVERSE PROXY (NGINX) — CHEAT SHEET
====================================
WHAT: a public-facing HTTP(S) intermediary in front of your app
servers that receives client requests and forwards them to
the right backend. Clients usually only see the proxy.
FORWARD vs REVERSE PROXY
Forward : in front of CLIENTS -> proxies outbound (server unaware)
Reverse : in front of SERVERS -> proxies inbound (client sees proxy)
THE REQUEST LIFECYCLE (2 connections, 4 hops)
Client --1--> Proxy --2--> Backend
Client <--4-- Proxy <--3-- Backend
FIVE EDGE JOBS
1. TLS termination : one public cert surface at proxy
2. Static serving : logo.png/app.js/style.css from proxy disk/cache
3. Path routing : /api /admin /static -> different backends
4. Caching : hit = no backend; miss = fetch + populate
5. Security : backends private; block bad requests at edge
vs LOAD BALANCER
LB : distribution-first; choose healthy backend / connection target
Proxy : public HTTP(S) edge tier; may ALSO balance while doing
TLS/cache/static/routing/security
-> use BOTH: dedicated LB in front of a proxy cluster when needed
vs API GATEWAY
Gateway : reverse-proxy-based API front door + policy
(auth, rate limit, aggregation, versioning, transforms)
Proxy : general web edge plumbing for HTTP(S) traffic
CACHING RULES
hit ratio is everything; miss = lookup + backend (slower)
NEVER share-cache per-user/authenticated content
reverse proxies cache too; CDN = that idea distributed globally
TLS
terminate at proxy for L7 visibility + central cert management
internal hop can be HTTP on trusted network or HTTPS/mTLS
HIGH AVAILABILITY
one proxy = single point of failure
cluster of stateless proxies behind a load balancer + health checks
FAILURE MODES (break / detect / recover)
proxy down : LB health check ejects -> peers take over
traffic spike: autoscale + cache/static offload
cache down : request-collapse + stale-while-revalidate
cert expiry : automate ACME renewal + alert early
bad routing : nginx -t, canary, roll back
backend down : health checks + retries on healthy replicas
DDoS : rate/conn limits at edge + CDN scrubbing
REFERENCE PRODUCTION ARCHITECTURE
Internet -> (CDN) -> Load Balancer -> Reverse Proxy Cluster
-> Backend Services (private network)
ONE-LINER
"A shared edge layer in front of your servers that handles TLS,
static files, routing, caching, and security so the app
servers do not each have to."