nsindocs Search the docs⌘K
  1. Docs
  2. Rules

Cache Rules

Control what nsin caches, how long, and which safety checks apply.

On this page

A cache rule controls caching for the addresses it covers; whichever rule matches decides how a request is cached.

Create a cache rule

  1. Rules → Add Rule → Cache Rule.
  2. Set the addresses it applies to (/*, /assets/*, etc.).
  3. Choose what to cache and for how long.
  4. Click Save.

Scope

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

  • 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=2 cache separately; off, they share one copy.

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?

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

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.

esc