19 / 25 · Service boundaries
Reverse proxy
A reverse proxy receives requests on behalf of backend servers and forwards them. It can terminate TLS, route paths or hosts and manage forwarding behavior. It is different from a forward proxy used on behalf of clients.
What you will practise
- Trace proxy forwarding
- align limits/timeouts
- define trusted headers
Before you start: HTTP request, backend and forwarded header.
About 4 minutes · offline-generated English female narration · captions included. Diagrams are conceptual; timings are illustrative.
Download MP4CaptionsListen without the video
Download audioChapters and full transcript
Let us understand reverse proxy. A reception desk receives mail for several offices and forwards each envelope internally. Outside visitors know the public address rather than every room. The desk must preserve important information and must not believe a forged note saying that an envelope came from the principal. A reverse proxy receives requests on behalf of backend servers and forwards them. It can terminate TLS, route paths or hosts and manage forwarding behavior. It is different from a forward proxy used on behalf of clients.
Follow the normal path. The browser talks to one public address. The reverse proxy represents backend servers rather than acting as the browser own outbound proxy. Host and path rules select a backend. Request size, deadlines, TLS termination and supported protocols must fit the actual workload. SeatSpot can expose one HTTPS hostname while forwarding application and static paths to different backends. This central entry layer needs deliberate timeout, buffering and trusted-header behavior.
Now change one condition. API traffic reaches the API backend and asset traffic can reach another backend. A reverse proxy can also perform load-balancing duties. A common misunderstanding is this: A reverse proxy and load balancer cannot be the same component. These are roles that can overlap in one product. Think about this. A client sends X-Forwarded-For claiming to be an administrator. Should your backend trust it? Pause the video and make your prediction. Only through a verified proxy chain with controlled header rewriting. A client-supplied header is not trusted identity.
Let us reason with a concrete example. A browser uploads a large image through a proxy to the application. The application body limit does not help if the proxy rejects it first; conversely, a permissive proxy does not bypass the application validation. The smallest relevant limit wins. Align intended limits and return understandable errors. For streaming, inspect buffering and timeouts along the full path. These figures are teaching examples, not production guarantees.
Turn the idea into a design decision. Forward useful request context, but do not accept forged identity or client-IP headers from arbitrary clients as trusted facts. Buffering and idle/read timeouts can change what a browser sees. Test streams and long-lived connections end to end instead of assuming default behavior fits. When you try the practice task, look for this result. The narrowest relevant limit can reject the request; streaming needs deliberate buffering and timeout choices.
Check your understanding. The public entry point needs its own capacity, redundancy and monitoring. Backend replicas do not help if the only proxy is unavailable. Here is a challenge. An API stream produces tokens but the browser sees them all at once. What might be happening? Pause before the answer. A proxy/CDN may buffer the response. Verify streaming support, flush behavior, timeout and cache/compression policies across the actual path before changing application logic blindly. For an interview, discuss TLS termination, headers, limits and connection draining. Say what you would measure, not only which tool you would buy.
Start with an everyday picture
A reception desk receives mail for several offices and forwards each envelope internally. Outside visitors know the public address rather than every room. The desk must preserve important information and must not believe a forged note saying that an envelope came from the principal.
Why SeatSpot needs this
SeatSpot can expose one HTTPS hostname while forwarding application and static paths to different backends. This central entry layer needs deliberate timeout, buffering and trusted-header behavior.
Trace one step at a time
Move through the diagram at your pace. Teal paths are active; unavailable components are labelled.
Receive the public request
The browser talks to one public address. The reverse proxy represents backend servers rather than acting as the browser own outbound proxy.
Read all six mechanism steps
Receive the public request
The browser talks to one public address. The reverse proxy represents backend servers rather than acting as the browser own outbound proxy.
Apply forwarding rules
Host and path rules select a backend. Request size, deadlines, TLS termination and supported protocols must fit the actual workload.
Forward the request
API traffic reaches the API backend and asset traffic can reach another backend. A reverse proxy can also perform load-balancing duties.
Preserve trusted context
Forward useful request context, but do not accept forged identity or client-IP headers from arbitrary clients as trusted facts.
Handle streaming deliberately
Buffering and idle/read timeouts can change what a browser sees. Test streams and long-lived connections end to end instead of assuming default behavior fits.
Protect the proxy tier
The public entry point needs its own capacity, redundancy and monitoring. Backend replicas do not help if the only proxy is unavailable.
Pause and make a prediction
A client sends X-Forwarded-For claiming to be an administrator. Should your backend trust it?
Correct a common misunderstanding
Claim to question: A reverse proxy and load balancer cannot be the same component.
Better explanation: These are roles that can overlap in one product.
Inspect a proxy path
- Draw browser → proxy → application.
- Put body limits and timeouts at both boundaries.
- Explain what changes for a long-lived stream or WebSocket.
Check what you can explain
This is your self-check, not an automated grade. Try again without the diagram tomorrow.
0 of 3 goals checked. Choose one remaining idea to practise next.
Teach it back
Without looking, explain what this component changes, what it does not solve and what happens if it fails. Use the animation to check your explanation, then switch to Engineering.
Engineering model and trade-offs
Decide where TLS terminates and whether backend connections also use TLS. Preserve/transform Host and forwarded headers deliberately. Backend code must trust identity/IP headers only from a known proxy chain.
Set request/body limits, connect/read timeouts and buffering behavior for the workload. A streaming response or WebSocket needs suitable handling rather than assuming ordinary buffered HTTP defaults.
A reverse proxy may also load balance or apply API policies. Avoid treating these roles as mutually exclusive products. Plan proxy redundancy and test backend failure and graceful connection draining.
Work through an example
A browser uploads a large image through a proxy to the application.
Reason with the numbers
The application body limit does not help if the proxy rejects it first; conversely, a permissive proxy does not bypass the application validation. The smallest relevant limit wins.
Make a decision
Align intended limits and return understandable errors. For streaming, inspect buffering and timeouts along the full path.
Implementation sketch
server {
listen 8080;
location /api/ {
proxy_pass http://app:3000;
proxy_set_header Host $host;
proxy_connect_timeout 2s;
proxy_read_timeout 30s;
}
}A minimal local example, not complete production configuration. proxy_pass URI/trailing-slash behavior matters; configure TLS, trusted headers and workload-specific limits separately.
Where this is used
- One public entry point for internal HTTP applications.
- TLS termination, path routing and suitable buffering policies.
Common mistakes
- Trusting arbitrary forwarded-IP headers.
- Breaking streams with inappropriate buffering/timeouts.
- Assuming proxy and application limits are identical.
Practise a reasoned answer
Answer aloud or write notes before opening the reference. These prompts teach reasoning and trade-offs; they are not claimed questions from a particular company.
Reverse proxy versus forward proxy?
Choose a practice depth
- Foundation
- Explain forwarding on behalf of servers.
- Practical
- Discuss TLS termination, headers, limits and connection draining.
- Advanced
- Defend trust boundaries, streaming behavior, redundancy and failure observability.
Self-check rubric
- State the required user outcome and the relevant invariant.
- Explain the normal path and one failure path.
- Name a cost or consistency/latency trade-off.
- Say what you would measure or test before trusting it.
For deeper practice, connect this topic to the previous lesson and identify a shared bottleneck. A longer answer is not automatically a better answer.
Try it before viewing the solution
An API stream produces tokens but the browser sees them all at once. What might be happening?
Check one key idea
Your explanation and interview notes
Saved only in this browser when storage is available. Export a backup from the course page before clearing browser data or moving devices.
Loading your local notes…
Official references and next reading
The explanation, fictional examples and animations are original teaching material. Vendor behavior depends on the specific product/version; use its documentation before deploying.