Firewall vs Proxy vs Reverse Proxy - Differences & Use Cases - Watch the Algorithm Execute, Step by Step
Watching the packet flow step-by-step reveals how firewalls filter traffic, proxies act on behalf of clients, and reverse proxies protect backend servers, making these concepts concrete and intuitive.
Step 1/11
·Active fill★Answer cell
Client sends packet to firewall
Hop: 1
Client
Firewall
Proxy Server
Reverse Proxy
Web Server
📦Packet
↗ fromclient
↘ tofirewall
📄 payloadHTTP GET /index.html
🔌 protocolHTTP
🚩 flags
src→10.0.0.1:12345
dst→93.184.216.34:80
data→HTTP GET /index.html
Packet created at client: HTTP GET /index.html
Firewall forwards allowed packet to proxy
Hop: 2
Client
Firewall
Proxy Server
Reverse Proxy
Web Server
📦Packet
↗ fromfirewall
↘ toproxy
📄 payloadHTTP GET /index.html
🔌 protocolHTTP
🚩 flags
src→10.0.0.1:12345
dst→93.184.216.34:80
data→HTTP GET /index.html
Packet created at client: HTTP GET /index.html
Firewall inspects packet and allows it
Proxy prepares to forward packet on behalf of client
Hop: 3
Client
Firewall
Proxy Server
Reverse Proxy
Web Server
📦Packet
↗ fromproxy
↘ toreverse_proxy
📄 payloadHTTP GET /index.html
🔌 protocolHTTP
🚩 flags
src→proxy_ip:54321
dst→93.184.216.34:80
data→HTTP GET /index.html
Packet created at client: HTTP GET /index.html
Firewall inspects packet and allows it
Proxy server receives packet from firewall
Proxy forwards modified packet to reverse proxy
Hop: 4
Client
Firewall
Proxy Server
Reverse Proxy
Web Server
📦Packet
↗ fromproxy
↘ toreverse_proxy
📄 payloadHTTP GET /index.html
🔌 protocolHTTP
🚩 flags
src→proxy_ip:54321
dst→93.184.216.34:80
data→HTTP GET /index.html
Firewall inspects packet and allows it
Proxy server receives packet from firewall
Proxy modifies packet headers to hide client IP
Reverse proxy prepares to forward packet to backend server
Hop: 5
Client
Firewall
Proxy Server
Reverse Proxy
Web Server
📦Packet
↗ fromreverse_proxy
↘ toserver
📄 payloadHTTP GET /index.html
🔌 protocolHTTP
🚩 flags
src→proxy_ip:54321
dst→93.184.216.34:80
data→HTTP GET /index.html
Proxy server receives packet from firewall
Proxy modifies packet headers to hide client IP
Reverse proxy receives packet from proxy
Reverse proxy forwards modified packet to backend server
Hop: 6
Client
Firewall
Proxy Server
Reverse Proxy
Web Server
📦Packet
↗ fromreverse_proxy
↘ toserver
📄 payloadHTTP GET /index.html
🔌 protocolHTTP
🚩 flags
src→reverse_proxy_ip:54321
dst→192.168.1.10:80
data→HTTP GET /index.html
Proxy modifies packet headers to hide client IP
Reverse proxy receives packet from proxy
Reverse proxy modifies packet headers for backend
Backend server starts processing HTTP request
Hop: 7
Client
Firewall
Proxy Server
Reverse Proxy
Web Server
📦Packet
↗ fromserver
📄 payloadHTTP GET /index.html
🔌 protocolHTTP
🚩 flags
src→reverse_proxy_ip:54321
dst→192.168.1.10:80
data→HTTP GET /index.html
Reverse proxy receives packet from proxy
Reverse proxy modifies packet headers for backend
Backend server receives packet from reverse proxy
Backend server sends response to reverse proxy
Hop: 8
Client
Firewall
Proxy Server
Reverse Proxy
Web Server
📦Packet
↗ fromserver
↘ toreverse_proxy
📄 payloadHTTP 200 OK
🔌 protocolHTTP
🚩 flags
src→192.168.1.10:80
dst→reverse_proxy_ip:54321
data→HTTP 200 OK
Reverse proxy modifies packet headers for backend
Backend server receives packet from reverse proxy
Backend server processes HTTP request and prepares response
Reverse proxy prepares to forward response to proxy
Hop: 9
Client
Firewall
Proxy Server
Reverse Proxy
Web Server
📦Packet
↗ fromreverse_proxy
↘ toproxy
📄 payloadHTTP 200 OK
🔌 protocolHTTP
🚩 flags
src→192.168.1.10:80
dst→reverse_proxy_ip:54321
data→HTTP 200 OK
Backend server receives packet from reverse proxy
Backend server processes HTTP request and prepares response
Reverse proxy receives response from backend server
Proxy sends response packet back to client
Hop: 10
Client
Firewall
Proxy Server
Reverse Proxy
Web Server
📦Packet
↗ fromproxy
↘ toclient
📄 payloadHTTP 200 OK
🔌 protocolHTTP
🚩 flags
src→proxy_ip:54321
dst→10.0.0.1:12345
data→HTTP 200 OK
Backend server processes HTTP request and prepares response
Reverse proxy receives response from backend server
Proxy receives response and forwards to client
Client completes receiving response
Hop: 11
Client
Firewall
Proxy Server
Reverse Proxy
Web Server
📦Packet
↗ fromclient
📄 payloadHTTP 200 OK
🔌 protocolHTTP
🚩 flags
src→proxy_ip:54321
dst→10.0.0.1:12345
data→HTTP 200 OK
Reverse proxy receives response from backend server
Proxy receives response and forwards to client
Client receives HTTP 200 OK response
Key Takeaways
✓ Firewalls filter traffic based on security rules before any other processing.
This filtering step is often invisible in code but critical to network security.
✓ Proxies act on behalf of clients, modifying requests to provide anonymity and caching.
Seeing header modifications visually clarifies how proxies mask client identity.
✓ Reverse proxies protect backend servers by intercepting requests and responses, hiding server details.
The reverse proxy’s role is subtle but essential for security and load balancing.
Practice
(1/5)
1. Trace the sequence of server state changes when a client sends a PATCH request to update a user's email address. Which of the following best describes what happens step-by-step?
easy
A. The server modifies only the specified email field without affecting other user data.
B. The server replaces the entire user resource with the new email data.
C. The server creates a new user resource with the updated email.
D. The server deletes the old email and then inserts the new email as a separate resource.
Solution
Step 1: Understand PATCH semantics
PATCH is used for partial updates, modifying only specified fields.
Step 2: Differentiate from PUT
PUT replaces the entire resource, while PATCH updates parts.
Step 3: Analyze options
The server modifies only the specified email field without affecting other user data correctly states partial modification; others describe full replacement or resource creation/deletion.
Final Answer:
Option A -> Option A
Quick Check:
PATCH modifies only the targeted fields without affecting the rest.
Hint: PATCH = partial update, PUT = full replace
Common Mistakes:
Confusing PATCH with PUT and thinking it replaces the whole resource
Assuming PATCH creates new resources
Believing PATCH deletes and reinserts fields
2. Trace the encapsulation process when a user sends an email from their client application. Which sequence correctly represents the PDUs as data moves down the OSI layers?
easy
A. Data -> Packet -> Segment -> Frame -> Bits
B. Bits -> Frame -> Packet -> Segment -> Data
C. Data -> Segment -> Packet -> Frame -> Bits
D. Segment -> Data -> Packet -> Frame -> Bits
Solution
Step 1: Identify PDU names per OSI layer
Application Layer and Presentation Layer use 'Data', Transport Layer uses 'Segment', Network Layer uses 'Packet', Data Link Layer uses 'Frame', Physical Layer uses 'Bits'.
Step 2: Follow encapsulation order
Data is segmented, then packets are created, frames are formed, and finally bits are transmitted.
Final Answer:
Option C -> Option C
Quick Check:
Correct encapsulation order matches OSI layering [OK]
Hint: Data -> Segment -> Packet -> Frame -> Bits follows OSI top-down encapsulation [OK]
Common Mistakes:
Confusing order of PDUs
Mixing up Segment and Packet roles
Reversing encapsulation direction
3. Which of the following statements best explains why recursive DNS queries can increase latency compared to iterative queries?
medium
A. Recursive queries always bypass DNS caching, causing repeated full lookups.
B. Recursive queries use UDP instead of TCP, which increases packet loss and retransmissions.
C. Recursive queries are sent directly to the authoritative server, which is slower than querying root servers first.
D. Recursive queries require the DNS server to perform multiple lookups on behalf of the client, adding processing time and network hops.
Solution
Step 1: Understand recursive query behavior
Recursive DNS servers perform all necessary lookups to resolve a domain fully before responding.
Step 2: Impact on latency
This means the recursive server makes multiple network requests, adding processing and network delay.
Step 3: Why other options are incorrect
Recursive queries do use caching (A is false), do not bypass root servers (C is false), and use UDP or TCP depending on size but that is unrelated to latency increase (D is false).
Final Answer:
Option D -> Option D
Quick Check:
Recursive queries add latency due to multiple lookups -> correct
Hint: Recursive queries do more work per request, increasing latency.
Common Mistakes:
Believing recursive queries bypass caching
Thinking recursive queries contact authoritative servers first
Confusing transport protocols with query type
4. Which of the following statements about Destination NAT (DNAT) and port forwarding is INCORRECT?
medium
A. Port forwarding requires both destination IP and port to be translated for external access to internal services
B. DNAT can be used to hide internal IP addresses from external clients by rewriting source IPs
C. DNAT changes the destination IP address of incoming packets to route them to internal hosts
D. Port forwarding enables external clients to reach specific internal servers behind a NAT
Solution
Step 1: Understand DNAT
DNAT modifies destination IP (and port) of incoming packets to internal hosts.
Step 2: Analyze each statement
DNAT changes the destination IP address of incoming packets to route them to internal hosts is correct; DNAT changes destination IP. Port forwarding requires both destination IP and port to be translated for external access to internal services is correct; port forwarding translates destination IP and port. DNAT can be used to hide internal IP addresses from external clients by rewriting source IPs is incorrect; DNAT does not rewrite source IPs to hide internal hosts. Port forwarding enables external clients to reach specific internal servers behind a NAT is correct; port forwarding enables external access.
Final Answer:
Option B -> Option B
Quick Check:
DNAT changes destination IP, not source IP [OK]
Hint: DNAT changes destination IP, not source IP
Common Mistakes:
Confusing DNAT with SNAT
Assuming DNAT hides internal IPs by source IP rewriting
Believing port forwarding only changes IP, not ports
5. If a real-time chat application needs to support thousands of clients with intermittent connectivity and occasional message bursts, which limitation of WebSockets should be considered, and what fallback mechanism is most appropriate?
hard
A. WebSocket cannot handle intermittent connectivity; fallback to opening multiple WebSocket connections per client
B. WebSocket does not support message ordering; fallback to SSE to guarantee ordered delivery
C. WebSocket connections consume significant server resources per client; fallback to HTTP Long Polling to reduce persistent connections
D. WebSocket has high latency for message bursts; fallback to HTTP/2 multiplexing to improve throughput
Solution
Step 1: Identify WebSocket resource usage
Each WebSocket connection requires server resources to maintain persistent connections, which can be costly at scale.
Step 2: Consider intermittent connectivity
Clients with intermittent connectivity may cause connection drops, increasing server load.
Step 3: Evaluate fallback options
HTTP Long Polling can reduce persistent connections by using short-lived requests, making it a suitable fallback.
Step 4: Analyze other options
WebSocket does not support message ordering; fallback to SSE to guarantee ordered delivery is incorrect; WebSocket supports message ordering. WebSocket cannot handle intermittent connectivity; fallback to opening multiple WebSocket connections per client is wrong because opening multiple connections per client worsens resource usage. WebSocket has high latency for message bursts; fallback to HTTP/2 multiplexing to improve throughput misattributes latency issues to WebSocket and suggests unrelated HTTP/2 multiplexing.
Final Answer:
Option C -> Option C
Quick Check:
WebSocket resource cost + intermittent clients -> fallback to Long Polling
Hint: WebSocket scales poorly with many persistent connections; Long Polling reduces connection count
Common Mistakes:
Assuming WebSocket handles intermittent connectivity gracefully without resource impact
Believing WebSocket lacks message ordering
Confusing HTTP/2 multiplexing with WebSocket fallback
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.