Cache — content caching
Cache lets VNIS keep copies of your content on the edge nodes, so later requests are served directly from the edge instead of going back to the origin (origin server). The result: faster page loads and less load on the origin.
Use this when: pages/resources change infrequently (images, CSS/JS, product pages, articles). Example: your shop has 10,000 product images — enable caching so the images are served from the edge and the origin does not have to handle every view.
There are 2 levels:
- Cache Settings — the default configuration for the whole domain (TTL, cache key, Vary).
- Cache Policy (path-based cache rules) — overrides for specific paths (see Example: Cache Policy — path rules).
Before you start
- You have added and verified the domain and pointed the CNAME to VNIS.
- You have configured the Origin/Upstream (origin server) for the domain.
How to: Cache Settings
- Go to Domains → select the domain → Cache tab.

- Turn on the Enabled switch.
- Set the Default TTL (default cache duration), for example
3600seconds (1 hour). - (Optional) Open Cache Key to choose how VNIS distinguishes cached copies (by query string, header, cookie…).
- Click Save. Wait a few seconds for the configuration to sync to the nodes.
Fields: Cache Settings
| Field | Meaning | Values | Default | Notes |
|---|---|---|---|---|
| Enabled | Turns caching on/off for the domain | On/off | On | Off = every request goes to the origin |
| Bypass cache | Skips the cache (always goes to the origin) | On/off | Off | Use for debugging |
| Default TTL | Default cache duration | Seconds, ≤ 31,536,000 | 3600 | Applies when the origin does not specify one |
| Max TTL | Maximum cache duration (ceiling) | Seconds, ≤ 31,536,000 | 2,592,000 | Must be ≥ Default TTL |
| Edge TTL | Separate TTL at the edge | Seconds (0 = use default) | 0 | If >0, must be ≤ Max TTL |
| Browser TTL | TTL sent to the browser | Seconds (0 = not set) | 0 | ≤ Max TTL |
| Stale while revalidate (SWR) | Keeps serving the old cached copy while a new copy is fetched in the background (SWR — stale-while-revalidate) | Seconds | 0 | Reduces latency on expiry |
| Stale if error | Allows serving the old copy when the origin fails | Seconds | 0 | Improves fault tolerance |
| Status TTL | TTL per HTTP status code | Map {code: seconds}, ≤500 entries | — | Codes 100–599, 0–86400 |
| Cache Key › Query strategy | How the query string is handled in the cache key | all / none / include / exclude | all | include/exclude are used with a parameter list |
| Cache Key › Query params | List of parameters for include/exclude | ≤50 parameters | — | — |
| Cache Key › Sort query | Sorts the query to increase the cache match rate | On/off | On | — |
| Cache Key › Header/Cookie include | Adds headers/cookies to the cache key | ≤16 of each type | — | More keys → fewer matches |
| Vary › Allowlist | List of headers that create cache variants | ≤8 | — | Many variants reduce cache efficiency |
Ignore client no-cache determines whether the edge ignores Cache-Control: no-cache / Pragma: no-cache sent by the browser/client. On (default) = the cached copy is still returned (CDN mode); Off = the client's request is honored and the request goes to the origin. Order of evaluation: if the request matches a Cache Policy rule → that rule's Ignore no-cache client value is used; if no rule matches → the value at the domain level here is used; if the domain has no cache configuration → the system-wide configuration is used. New domains and new rules both default to On.
Example: Cache Policy — path rules
Cache Policy lets you set separate rules for each path. Rules have a priority: lower numbers run first, and evaluation stops at the first matching rule.
Example 1 — Cache static images for 7 days.
- Condition:
url_pathstarts_with/assets/ - Set: Edge TTL =
604800(7 days). - Expected result: images in
/assets/are served from the edge, and the response includesX-Cache: HIT(if Enable X-Cache is on). - How to check:
curl -I https://example.com/assets/logo.pnga second time → you seeX-Cache: HIT.
Example 2 — Do not cache the API.
- Condition:
url_pathstarts_with/api/ - Turn on: No cache.
- Result: every
/api/*request always goes to the origin and is not stored at the edge. - How to check: call
/api/...several times → alwaysX-Cache: MISS/never a HIT.
Example 3 — Force caching of product pages even when the origin returns no-cache.
- Condition:
url_pathstarts_with/products/ - Turn on: Ignore no-cache origin (forces caching, ignoring the origin's
Cache-Control: no-cachedirective). - Result: product pages are cached for the Edge TTL you set.
- Warning: only force caching of content that is public and the same for everyone. Do not force caching of pages with per-user data (shopping cart, account) — this would expose one user's data to another. VNIS still keeps some "safety floors" (no caching when
AuthorizationorSet-Cookieis present…), but you still need to limit the rule to the correct paths yourself. - How to check: run
curl -Itwice → the second time showsX-Cache: HITeven though the origin sendsno-cache.
Note on "safety floors": the floors that prevent caching when Set-Cookie / Authorization is present have one exception — if the origin also sends Cache-Control: public, these floors are skipped and the content is still cached. For this reason, do not let the origin return Cache-Control: public on responses that carry per-user data.
Other flags in a Cache Policy: Ignore query string, Disable auto compression, Edge/Browser TTL, Stale while revalidate / if error, a separate Cache Key/Vary, and Response headers (modify the response headers). Conditions support the fields: url_path, query_string, method, hostname, user_agent, cookie, origin, via, ip_source; operators: equals, regex, starts_with, ends_with, contains (with case-insensitive variants).
Order of evaluation
- Cache Policy › domain Cache Settings › system-wide configuration. Within Cache Policy, the lower the priority number, the higher the precedence; the first matching rule (lowest priority number) wins.
- Multiple rules can share the same priority — in a tie, the rule listed first is chosen.
- A rule with an empty condition matches every request — give it a high priority number (runs last) to use it as a "default" rule, so it does not swallow all other rules.
- Several rules for the same path: the rule with the lower priority number wins.
Troubleshooting
| Symptom | Common cause | Fix |
|---|---|---|
Always X-Cache: MISS | The origin sends no-cache/no-store/Set-Cookie; or the query string differs on every request | Use a Cache Policy with Ignore no-cache origin (on the correct public paths); or set Query strategy = none/exclude |
| Old content is not updated | TTL is too long | Lower the TTL, or Purge that path (see the Purge & Warm page) |
| Cached content is mixed up between users | A personal page was force-cached by mistake | Remove Ignore no-cache origin from that path; cache only public paths |
| Cannot save, error 422 | Invalid field value (for example Edge TTL > Max TTL) | Correct it according to the table in Fields: Cache Settings and save again |
FAQ
- Is the cache cleared automatically when I update content? VNIS does not know about it automatically; Purge the changed path, or set a short TTL.
- How do I know whether a URL is a HIT or a MISS? Turn on Enable X-Cache in the Cache Policy, then check the
X-Cacheheader withcurl -I. - I set a TTL of 1 day but the origin says 5 minutes. Which one wins? By default VNIS honors the origin; to enforce your TTL, use a Cache Policy with
Ignore no-cache origin/set an Edge TTL. - Is it a problem to Vary on many headers? Each header in Vary creates another cache variant → lower HIT ratio. Keep the Vary list to a minimum (at most 8).