---
title: "What Is a Caching Proxy? How Proxy Caching Works"
description: "A caching proxy saves copies of responses and serves them to later requests, cutting load times and bandwidth. Cache-Control headers set the rules."
url: "https://rayobyte.com/blog/what-is-a-caching-proxy/"
author: "Shafayat Hossain"
categories: "Proxies, Proxies for Beginners"
published: "2026-11-30T14:44:54.344Z"
updated: "2026-11-30T14:44:54.344Z"
---

# What Is a Caching Proxy?

A caching proxy saves copies of the responses it fetches and serves them to later requests for the same content, cutting load times and bandwidth.

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](https://rfc-editor.org/rfc/rfc9111) (June 2022), calls this a shared cache: one that "stores responses for reuse by more than one user."

1. A client sends a request through the caching proxy.
2. The proxy looks for a stored response to the same URL.
3. If the stored copy is fresh, the proxy returns it at once, which is a cache hit.
4. If there's no copy, the proxy forwards the request to the origin server, which is a cache miss.
5. 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.
6. 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](/blog/forward-proxies/) covers both directions, [what a reverse proxy is](/blog/what-is-a-reverse-proxy/) explains the website side, and [what a proxy server is](/blog/what-are-proxies/) 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:

```nginx
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 `private` or `no-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](/products/rotating-proxies/) start from $0.0080/GB and [residential proxies](/products/residential-proxies/) from $0.0095/GB at volume, and the [pricing page](/pricing/) lists every plan. Our guide to [scraping faster without burning proxies](/blog/optimizing-web-scraping-speed-without-burning-proxies/) covers caching in a scraping pipeline.
**Rotating proxies from $0.0080/GB and residential proxies from $0.0095/GB.** [Start free trial](https://app.rayobyte.com/auth/register)

## Frequently asked questions

### What is a cache hit and a cache miss?

A cache hit happens when a caching proxy answers a request from a stored copy without contacting the origin server. A cache miss happens when the proxy has no usable copy and has to fetch the response from the origin. A higher share of hits means faster responses and less traffic to the origin.

### How long does a caching proxy keep a page?

A caching proxy keeps a page fresh for as long as its headers allow: s-maxage or max-age in seconds, or until the Expires date. After that the copy is stale, and the proxy checks with the origin before reusing it. The proxy can also delete copies earlier to free space, starting with ones nobody has requested lately.

### Can a caching proxy show outdated content?

Yes, a caching proxy can show outdated content when the origin changes a page before the cached copy's freshness lifetime runs out. Visitors keep getting the old copy until it turns stale. Site owners prevent this with shorter max-age values, no-cache for pages that change often, or by purging the cache after an update.

### What is the difference between a caching proxy and a browser cache?

A caching proxy is a shared cache that stores responses for many users, while a browser cache is a private cache that stores responses for one user on one device. The difference matters for personal pages: a response marked private can sit in your browser cache, but a caching proxy must not store it.
