# Edge cache and CDN

> Edge caching is included on every site: full page caching, Smart Tiered Cache, and Argo. The Caching page covers cache times, skipped paths, and parameters.

Source: https://docs.wpwaterfall.com/edge-cache

Open your site, then **Caching**. The page has five tabs and a **Clear all caches** button at the top. Clear all caches empties the page cache, the object cache, PHP's code cache (OPcache), and the edge cache. WordPress admins can also run it from the admin bar. See [Clear all caches](https://docs.wpwaterfall.com/clear-caches). Every change runs as a job you can follow in the jobs drawer.

## What edge caching does every site get?

Every site gets the same edge caching, included in every plan. There is no add-on to buy and nothing to turn on.

- **Full page caching at the edge**: each Cloudflare location your visitors reach keeps its own copies of your HTML pages and static files (images, CSS, JavaScript, fonts), close to those visitors.
- **Smart Tiered Cache for static files**: when a location does not have a static file yet, it asks a Cloudflare upper tier location before it asks your server, so your server sends each file far fewer times. HTML pages are cached in each location on its own.
- **Argo Smart Routing**: requests that must reach your server, such as cache misses, logged in visitors, carts, and other dynamic pages, take the fastest path across Cloudflare's network.
- **Brotli**: smaller files for every visitor.
- **Purge by URL or by tag**: clear one page, a path and everything under it, or a group of pages by cache tag. Publishing a post clears the pages it touches.

**Is there a limit?** Argo carries the traffic between Cloudflare and your server, and that traffic counts toward your plan's server bandwidth allowance, as it always has. There is no separate price for edge caching or Argo. Rates past an allowance are in [Billing and plans](https://docs.wpwaterfall.com/billing-and-plans#how-usage-is-measured-and-billed).

## Edge Caching

Edge Caching keeps your pages in Cloudflare locations worldwide, close to your visitors. **Disable** turns it off, and the tab then hides its cards until you enable it again.

- **Suspended sites**: while a site is suspended for an unpaid invoice, the edge keeps no copy and serves none, so visitors reach the site and see the suspended page at once. The cache comes back when the site does.
- **Mobile cache**: a separate page cache for phones. See [Mobile cache](#mobile-cache) below.
- **Clear cache**: clears every cache, the same as Clear all caches.
- **Edge cache time**: how long the edge keeps a page, from 30 minutes to 30 days. The default, 1 hour, is marked.
- **Clear URL cache**: type a path such as `/blog/` or a full URL on the site, or pick one from the list. Tick the box to also clear every page under it.

## CDN

The CDN serves images, CSS, and JavaScript files from Cloudflare. It runs on the same switch as Edge Caching, so turning one off turns off both. The tab has three cards:

- **Clear CDN cache** clears those files at Cloudflare, which you need when you replace a file and keep its name.
- **Image optimization**: **Settings** opens a dialog with None, Lossless, and Lossy. See [Image optimization](https://docs.wpwaterfall.com/image-optimization).
- **Exclude files from CDN**: **Settings** opens a page where you keep files out of the CDN. See [Exclude files from the CDN](https://docs.wpwaterfall.com/cdn-exclusions).

Both cards run as jobs. When the server could not take a setting yet (an older server agent, or a Cloudflare rule that could not be set up), the card says the setting is saved and not applied yet, and why. A change to either card clears your site's files at the CDN, so the new rules apply to every visitor at once.

## Server Caching

The server keeps a page cache for visitors who are not logged in. **Change cache expiration** sets how long it keeps a page, from 30 minutes to 30 days, with the default of 1 hour marked. **Disable** turns the server cache off: every page then runs PHP and the header says `BYPASS`. **Clear cache** clears every cache. Clear any theme or plugin cache first.

The server never caches a page for a logged in visitor, a cart, a POST, or a response that sets a cookie. **Remove Set-Cookie headers** in **Tools** changes the last rule.

Staging and preview environments have no page cache and no CDN cache. The **Caching** page is for live only, and the environment details on **Info** list the server cache, the CDN, and edge caching as off there. See [Clear all caches](https://docs.wpwaterfall.com/clear-caches#staging-and-preview-environments).

## Rules

The **Rules** tab holds what the cache skips and what it treats as one page.

- **Paths the cache skips**: add a path such as `/checkout`. A page whose path starts with it is never cached, at the edge or on the server. Remove a path with **Remove**.
- **Query parameters to ignore**: addresses that differ only by these parameters share one cached page, at the edge and on the server. `utm_*`, `fbclid`, and `gclid` are on the list by default. The server shares the page when the whole query string is made of ignored parameters; a mix such as `?p=1&utm_source=x` is its own page there.
- **Scheduled purge**: clear all caches on a timetable. See [Scheduled purges](https://docs.wpwaterfall.com/clear-caches#how-do-i-schedule-a-purge).

Each change to the lists runs as a job. Only people who can manage the edge see the buttons. Everyone else sees the lists.

## Redis

Redis is the object cache add-on. When the site has it, the tab says **Enabled** and shows whether WP Waterfall verified that WordPress uses Redis, with the memory used, the keys, and the hit rate. **Check again** runs the check once more. The tab appears only once the site has bought the add-on: until then there is no Redis tab, and you buy it on **Add-ons**. See [Object Cache](https://docs.wpwaterfall.com/object-cache).

## Read the cache header

Every page carries `x-wpwaterfall-cache`: HIT, MISS, BYPASS, STALE, or EXPIRED. Through the edge it is the edge's answer, and `x-wpwaterfall-origin-cache` is the server's. `cf-cache-status` is Cloudflare's own view of the same answer. A new site is cached at the edge from its first minute. Cache numbers are in [Analytics](https://docs.wpwaterfall.com/analytics).

## Mobile cache

Mobile cache keeps a second copy of each cached page for phones. Desktop visitors keep getting the normal cached page. Most themes send the same page to every device and change the layout with CSS, and those sites do not need it. Turn it on when your theme or a plugin prints different HTML for phones, usually through WordPress's `wp_is_mobile()`.

1. Open your site and go to **Caching**.
2. On **Edge Caching**, find **Mobile cache** and choose **Enable** or **Disable**.

The change is a job. It applies the setting on the server and at the edge, then clears your site's caches. You need the permission to manage edge settings. The card shows only while Edge Caching is enabled.

- **Who counts as mobile:** the same test as `wp_is_mobile()`. That is the `Sec-CH-UA-Mobile` hint when the browser sends it, and otherwise a User-Agent that contains `Mobile`, `Android`, `Silk/`, `Kindle`, `BlackBerry`, `Opera Mini`, or `Opera Mobi`.
- **A theme that detects devices its own way,** or changes `wp_is_mobile()` with a filter: test a phone and a desktop after you turn it on.
- **Cloudflare plan:** WP Waterfall keys mobile pages apart itself, so it works on the Cloudflare Free plan and uses no shared Cloudflare rules.
- **Clearing a URL** clears both its desktop and mobile copies.
- **An older server agent** keeps one shared page cache, and the job says the server needs an agent update.
- **API:** `PUT /v1/environments/{id}/tools/mobile-cache` with `{"enabled": true}` or `{"enabled": false}` answers 202 with the job. The environment's `tool_settings.mobile_cache` shows the setting. The MCP tool is `set_mobile_cache`.

## Geolocation

Geolocation lives in **Tools**. It passes the visitor's location to PHP, and with it on, cached pages vary by the visitor's country. The city, region, and postal code reach only pages that are never cached. See [Tool settings](https://docs.wpwaterfall.com/tools-settings#how-do-plugins-read-the-visitor-s-location). Preload headers, which Cloudflare answers as 103 Early Hints, are a part of [Speed optimizations](https://docs.wpwaterfall.com/speed-optimizations).

## Limits

- The static file cache time is set through the API only.

## Related

- [Image optimization](https://docs.wpwaterfall.com/image-optimization)
- [Exclude files from the CDN](https://docs.wpwaterfall.com/cdn-exclusions)
- [Clear all caches](https://docs.wpwaterfall.com/clear-caches)
