0
0
Nginxdevops~10 mins

Why reverse proxying serves backend applications in Nginx - Visual Breakdown

Choose your learning style9 modes available
Process Flow - Why reverse proxying serves backend applications
Client sends request
Reverse Proxy receives request
Reverse Proxy forwards request to Backend
Backend processes request
Backend sends response to Reverse Proxy
Reverse Proxy sends response to Client
The client sends a request to the reverse proxy, which forwards it to the backend server. The backend processes it and sends the response back through the proxy to the client.
Execution Sample
Nginx
server {
  listen 80;
  location / {
    proxy_pass http://backend_server;
  }
}
This nginx config sets up a reverse proxy that forwards all client requests to a backend server.
Process Table
StepActionRequest StateBackend StateResponse State
1Client sends HTTP request to nginx reverse proxyRequest received by proxyNo action yetNo response yet
2nginx reverse proxy forwards request to backend serverRequest forwardedRequest received by backendNo response yet
3Backend processes requestRequest forwardedProcessing requestNo response yet
4Backend sends response to nginx reverse proxyRequest forwardedResponse sentResponse received by proxy
5nginx reverse proxy sends response to clientRequest completedResponse sentResponse sent to client
6Connection endsNo active requestIdleClient received response
💡 Request cycle completes when response is sent back to client and connection closes.
Status Tracker
VariableStartAfter Step 2After Step 4Final
Request StateNot receivedReceived and forwardedForwarded, waiting responseCompleted
Backend StateIdleRequest receivedResponse sentIdle
Response StateNo responseNo responseReceived by proxySent to client
Key Moments - 3 Insights
Why does the client not communicate directly with the backend?
The client sends requests to the reverse proxy, which forwards them to the backend. This is shown in execution_table steps 1 and 2 where the proxy receives and forwards the request.
What happens if the backend is slow or down?
The reverse proxy can handle retries, caching, or show error pages. This is implied in step 3 and 4 where the backend processes or fails to respond, but the proxy manages the client connection.
Why is the response sent back through the reverse proxy?
The proxy controls the client connection and can modify or secure responses. Execution_table steps 4 and 5 show the backend sending response to proxy, which then sends it to client.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which step does the backend first receive the client request?
AStep 3
BStep 1
CStep 2
DStep 4
💡 Hint
Check the 'Backend State' column to see when the backend receives the request.
At which step does the reverse proxy send the response back to the client?
AStep 5
BStep 3
CStep 4
DStep 6
💡 Hint
Look for when 'Response sent to client' appears in the 'Response State' column.
If the backend is down and does not respond, which step would be delayed or missing?
AStep 2
BStep 4
CStep 3
DStep 5
💡 Hint
Step 4 shows backend sending response; if backend is down, this step won't happen.
Concept Snapshot
Reverse proxy acts as a middleman between clients and backend servers.
Clients send requests to the proxy, not directly to backend.
Proxy forwards requests, receives backend responses, then sends them to clients.
Benefits include security, load balancing, caching, and hiding backend details.
Nginx config example: proxy_pass directive forwards requests to backend.
Full Transcript
When a client wants to access a backend application, it sends a request to the reverse proxy server instead of directly contacting the backend. The reverse proxy receives the request and forwards it to the backend server. The backend processes the request and sends the response back to the reverse proxy. Finally, the reverse proxy sends the response to the client. This setup helps protect the backend, balance load, and manage traffic efficiently. The nginx configuration uses the proxy_pass directive to forward requests to the backend server.