A caching proxy is a proxy server that saves copies of the responses it fetches, such as pages, images and files, and serves those copies to later requests for the same content instead of contacting the origin server again. Caching proxies cut load times and bandwidth, and HTTP Cache-Control headers decide what they may store and for how long.
| Caching proxy at a glance | |
|---|---|
| What it stores | Copies of HTTP responses: pages, images, scripts, downloads |
| Who it serves | Many users at once (a shared cache) |
| Cache hit | The proxy answers from its stored copy |
| Cache miss | The proxy fetches from the origin server, then stores the response if allowed |
| Rules come from | Cache-Control and related headers, defined in RFC 9111 |
| Common software | Squid, NGINX, Varnish, Apache Traffic Server, CDNs |
How does a caching proxy work?
A caching proxy works by checking its store before it forwards each request, and answering from a saved copy when one is still fresh. The HTTP caching standard, RFC 9111 (June 2022), calls this a shared cache: one that "stores responses for reuse by more than one user."
- A client sends a request through the caching proxy.
- The proxy looks for a stored response to the same URL.
- If the stored copy is fresh, the proxy returns it at once, which is a cache hit.
- If there's no copy, the proxy forwards the request to the origin server, which is a cache miss.
- If the copy is stale, the proxy asks the origin whether it changed, and the origin can answer 304 Not Modified so the proxy reuses its copy.
- The proxy stores new responses that the headers allow it to keep, then returns them to the client.
RFC 9111 defines a fresh response as one whose age hasn't passed its freshness lifetime, and a stale response as one whose age has.
What is the difference between a forward and a reverse caching proxy?
A forward caching proxy sits in front of users and saves the content they request, while a reverse caching proxy sits in front of a website and saves the content it serves. Both work the same way and differ in who they work for.
| Forward caching proxy | Reverse caching proxy | |
|---|---|---|
| Sits in front of | Users on a network | Web servers |
| Deployed by | A company, school or ISP | The website owner or its CDN |
| Saves bandwidth on | The network's internet link | The origin servers |
| Examples | Squid on an office network | NGINX or Varnish in front of an app, CDN edge servers |
Our guide to forward vs reverse proxies covers both directions, what a reverse proxy is explains the website side, and what a proxy server is covers the basics.
Which HTTP headers control a caching proxy?
HTTP response headers control a caching proxy, mainly the Cache-Control header, which says whether a response can be stored, by whom and for how long. RFC 9111 defines these directives:
| Directive or header | What it tells a caching proxy |
|---|---|
max-age=60 |
The response stays fresh for 60 seconds |
s-maxage=300 |
For shared caches only, overrides max-age |
private |
A shared cache must not store the response; the user's browser still can |
no-store |
Don't store any part of the request or response |
no-cache |
Store it if you like, but check with the origin before each reuse |
Age |
Sent by the cache: an estimate of how long ago the response was generated or validated |
ETag, Last-Modified |
Let the proxy check whether a stale copy is still current |
Caches pick the freshness lifetime in order: s-maxage for shared caches, then max-age, then the Expires header, and a heuristic only when none is present. RFC 9111 also says a shared cache must not reuse a response to a request that carried an Authorization header unless a directive explicitly allows it, which keeps one user's logged-in pages away from another.
How do you set up a caching proxy with NGINX?
You set up a caching proxy with NGINX by defining a cache store with proxy_cache_path and turning it on with proxy_cache in the location that passes requests to the origin:
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=pages:10m max_size=1g inactive=60m;
server {
listen 80;
location / {
proxy_pass http://127.0.0.1:3005;
proxy_cache pages;
add_header X-Cache-Status $upstream_cache_status;
}
}The X-Cache-Status header shows whether each response was a HIT or a MISS. We tested this config with NGINX 1.24.0 in November 2026, in front of a test origin that sent Cache-Control: public, max-age=60 for product pages and Cache-Control: private, no-store for an account page:
| Request | X-Cache-Status | Reached the origin? |
|---|---|---|
| First request to /products/42 | MISS | Yes |
| Next five requests to /products/42 | HIT | No |
| Every request to /account | MISS | Yes, never stored |
Six requests for the product page reached the origin once, and the account page was never stored, as its headers required. Run nginx -t to check the syntax, then sudo nginx -s reload to apply it.
What should a caching proxy not cache?
A caching proxy should not cache responses that belong to one user or that must always be current. The headers usually handle this, but check these cases when you set one up:
- Personal pages: account pages, carts and dashboards, which origins should mark
privateorno-store. - Logged-in requests: responses to requests with an Authorization header, which RFC 9111 keeps out of shared caches by default.
- Live data: prices, stock levels and scores that change by the second, which need short lifetimes or
no-cache. - Sensitive downloads: files that shouldn't sit on a shared disk, which should be sent with
no-store.
Do caching proxies matter for web scraping?
Caching proxies matter for web scraping in two ways: a cache on your side saves bandwidth on pages you fetch again, and caches on the target's side can serve you a stored copy instead of the latest version. For price or stock monitoring, compare the response's Age header to how fresh your data needs to be.
Proxy bandwidth is usually billed by the gigabyte, so refetching unchanged pages costs money. As of November 2026, Rayobyte's rotating proxies start from $0.0080/GB and residential proxies from $0.0095/GB at volume, and the pricing page lists every plan. Our guide to scraping faster without burning proxies covers caching in a scraping pipeline.