Cache Rules
A cache rule controls caching for the addresses it covers; whichever rule matches decides how a request is cached.
Create a cache rule
Section titled “Create a cache rule”- Rules → Add Rule → Cache Rule.
- Set the addresses it applies to (
/*,/assets/*, etc.). - Choose what to cache and for how long.
- Click Save.
| Scope | What it caches |
|---|---|
| Static files | Images, CSS, JS, fonts, downloads. Safe default. |
| Everything | Every cacheable response, HTML included. |
No “custom” scope — narrow the rule’s paths to cache less.
TTL, refresh, query string
Section titled “TTL, refresh, query string”- TTL — how long a copy stays fresh before nsin re-fetches.
- Background refresh — nsin re-fetches on a schedule while still serving the current copy, so visitors never wait.
- Include query string — on,
?page=1/?page=2cache separately; off, they share one copy.
Safety checks
Section titled “Safety checks”On by default so caching can’t leak private data. Turn one off only if the response is identical for everybody.
| Check | What it does |
|---|---|
Skip requests with an Authorization header | Doesn’t cache authenticated requests. |
| Skip responses that set a cookie | A session cookie is personal. |
Honour no-store from the visitor | Respects a browser’s no-store. |
Honour your server’s Cache-Control | Server’s headers decide. |
Use your server’s max-age | Uses server’s max-age, not the rule’s TTL. |
| Never cache WordPress admin/login | Leaves /wp-admin and /wp-login.php alone. |
Should I cache it?
Section titled “Should I cache it?”| If the page… | Do this |
|---|---|
| Same for everyone (blog post, image) | Cache it |
| Differs per person (account, cart) | Don’t cache, or keep safety checks on |
| Changes constantly (live scores) | Short TTL, or background refresh |
Common questions
Section titled “Common questions”A private page got cached and showed the wrong data. Exclude that path, then purge once. Usual cause: an Everything-scope rule with the cookie check off.
My changes aren’t showing. Purge, or use developer mode.
Which rule applied to a request?
Check the Nsn-Cache-Status header — see
Proxy Headers.