Question presented to candidate: "People use the word 'proxy' for two quite different things. Explain the difference between a forward proxy and a reverse proxy β who sets each one up, who it protects, and what you would use each for. Then tell me how a backend behind a reverse proxy finds out the real client IP."
What a strong answer should cover:
- The core distinction: a forward proxy acts on behalf of clients (the server sees the proxy, not the user); a reverse proxy acts on behalf of servers (the client sees the proxy, not the backends)
- Who configures it: clients are configured to use a forward proxy (browser settings,
HTTPS_PROXY, PAC files); a reverse proxy is invisible to clients, who just resolve the site name to it - Uses: forward β egress filtering, auditing, shared caching, a fixed egress IP; reverse β load balancing, TLS termination, caching, compression, routing, hiding and protecting backends
- HTTPS through a forward proxy uses the
CONNECTmethod to tunnel, so the proxy sees the host name but not the content unless it intercepts TLS - Client identity behind a reverse proxy: X-Forwarded-For / RFC 7239 Forwarded, why the left-most entry is spoofable, and trusting only known proxy hops
Code / implementation expected: No β a clear contrast with examples is enough; the example shows who sees which address and how to parse X-Forwarded-For safely.