edgeacademyCUSTOMER ENGINEERING
MODULE 02 · LESSON 4 OF 5

Reverse proxies, forward proxies, and cache decisions

12 min read · Sources linked below

Theory and industry practice are explained below. Cloudflare-specific behavior links to official documentation. Customer examples are hypothetical.

Learning objectives

  • Distinguish forward and reverse proxy roles
  • Explain cache keys and eligibility
  • Balance reuse, freshness, and privacy

The mental model

A reverse proxy represents servers to clients. A forward proxy represents clients as they reach other services. This viewpoint matters: a company may use a forward proxy to control employee browsing while its public website uses a reverse proxy for security and delivery. A CDN stores selected responses near users, reducing repeated origin work when a valid cached response is reusable. A cache miss is not automatically a fault; the response may be new, expired, private, or deliberately excluded. Correct caching balances speed, freshness, and privacy. The key question is not whether everything can be cached, but which requests are safe to share and for how long.

How it works

A cache key maps a request to a stored representation. If two users with different authorized data map to the same shared key, a misconfiguration can expose one user's response to another. Conversely, unnecessary variation in the key can fragment the cache and lower reuse. Define which request properties affect content, then align the key and eligibility policy with those properties. HTTP caching uses directives and validators to control freshness and revalidation; vendor configuration can add further rules, so inspect the effective behavior.

A hit can be served from a valid stored response. A miss or bypass generally requires downstream work, though exact handling depends on the system. Revalidation can ask whether a stored representation remains current, potentially avoiding transfer of the full body. Record cache status, age, origin request counts, and response correctness together. A high hit ratio is not inherently good if stale or private content is served. For Cloudflare, consult cache eligibility and rule documentation rather than assuming every dynamic response is cached by default. Use a narrow public asset experiment first, then test query strings, cookies, authentication, updates, and purge behavior before expanding scope.

Applied example · hypothetical

Hypothetical example: a public product image benefits from a long-lived cache, while an account balance does not belong in a shared cache without carefully designed isolation. A team enables a broad rule and celebrates lower origin load, but a test with two authenticated accounts shows reused personalized content. The correct response is to remove the unsafe eligibility, invalidate affected objects as appropriate, investigate exposure, and redesign the policy. Performance measurement must therefore include correctness tests, not just a faster response time or a better hit percentage.

In a customer engagement

For a Cloudflare customer, identify public assets, personalized endpoints, and update frequency before recommending cache rules. Explain how origin headers and configured rules interact using a controlled request. Ask the application owner to verify content isolation and freshness. The customer should understand the operational cost of purging and the impact of a cold cache during rollout or failover.

Interview relevance

A senior answer treats caching as a correctness decision with performance benefits. Explain the key, eligibility, freshness, and invalidation path. If asked why a CDN did not speed up an API, inspect cacheability and origin work before proposing broader rules that could violate privacy or application semantics.

Common mistakes

  • Treating a miss as a service failure
  • Optimizing hit ratio without correctness tests
  • Caching personalized content under a shared key

Key terminology

Reverse proxy — An intermediary acting on behalf of upstream servers.

Forward proxy — An intermediary acting on behalf of clients accessing other services.

Cache key — The request-derived identifier used to select a cached representation.

Explain it without the page

  • Which request fields actually change your application response?
  • What happens to origin load after a purge?

Further reading

Sources explain the underlying concepts; examples and practice answers are original course material. Recheck current limits and plan eligibility before a real proposal.