r/WordpressPlugins • • Oct 27 '26

Free [FREEMIUM] WordPress caching that checks before it touches

Made a free WordPress caching plugin, now on WordPress.org. Two things it does differently: it checks before it touches (another cache plugin's file is left alone and named), and visitors arriving from Facebook, Google Ads or utm links get the cached page, because those tracking parameters are ignored by the cache out of the box. Logged-in visitors and carts are never cached. Feedback welcome: https://wordpress.org/plugins/cachingout

1 Upvotes

6 comments sorted by

1

u/PeepSoWP 29d ago

Ignoring tracking parameters is safe only when they cannot change the rendered response. Consent tools, affiliate attribution, currency, geolocation, or personalization may vary the page even for a logged-out visitor. I would normalize only an explicit allowlist and test the response body with and without each ignored parameter. How does the plugin prevent a UTM visit from populating the cache with content that should differ for later visitors?

1

u/Barquish 29d ago

Thanks, you were right on both counts and we reproduced them. Fixed in next release 1.25.1 so that a visit carrying only ignored tracking parameters is now served from an existing cached copy but never creates one, and every Set-Cookie header is checked, not just the last. If you're on an earlier version, update shortly and purge the cache once.

2

u/PeepSoWP 29d ago

Good fix. Please make those two cases permanent regressions: ignored tracking parameters must never create a cache variant, and any Set-Cookie header must bypass cache creation. Does the test suite cover multiple Set-Cookie headers plus concurrent first requests, so a race cannot publish a response that should be private?

1

u/Barquish 29d ago

First of all, I am deeply grateful for such great feedback, which is what we need to keep this a top class plugin of the AI era. So many AI offering seem to be pulling a lot of early adopters away from WordPress, not realising that a lot of what they are producing is front-end JS, poster sites. Now to your further comment.

Both are permanent now. We ran eight unit tests in the cacheability suite, and seven HTTP-level checks in the end-to-end suite that gates every release (four of them fail against the previous version, so we know they can catch it).

We don't bypass on every Set-Cookie, deliberately. Consent banners, language switchers and analytics set cookies on public pages, and refusing those would switch caching off on a lot of normal sites. We refuse responses that set session, login, cart or store cookies, plus any cookie the site owner lists. A cached copy is only the page body so a cache hit never replays any visitor's Set-Cookie.

On your races comment, now each request's cache decision is made from its own request and response, in its own process. A response that fails the check never reaches the write path, and copies are written to a unique temp file and renamed into place, so a race can't publish a private response or a half-written one. You're right that no test fires concurrent first requests, so, we're adding one. We're also looking at honouring Cache-Control, namely, private / no-store from the response, the standard per-visitor signal.

2

u/PeepSoWP 29d ago

Selective Set-Cookie handling is practical, but it makes cookie classification part of the security boundary. I would bypass unknown cookies by default and allowlist only known public-only cookies, then honor private and no-store before any write. For the concurrency regression, will you include two first responses for the same key where one sets a session cookie and they finish in both possible orders?

1

u/Barquish 29d ago

Both fair points again. To be precise on where we are now, after your comments this afternoon. 1.25.1 (out now) checks every Set-Cookie header and never writes from a tracked first visit.

With respect to your reference of Cache-Control, you're right that we don't honour a response's own private / no-store yet. That's queued for the next release. A page a plugin marks as per-visitor will never be written, and the debug header will name the directive.

For unknown cookies, we considered bypass-by-default and decided against it for now. On ordinary WordPress sites, consent banners, language switchers and analytics plugins set cookies on anonymous pages, so it would quietly switch caching off for many sites.

Two mitigations to overcome that. Cached copy stores only the body and never replays a Set-Cookie, and any cookie can be added to the never-cache list. The denylist is a trade-off we made knowingly, not an oversight.

Concurrency, certainly. The same release adds two first requests for the same key, one setting a session cookie, finishing in both orders. It asserts the cached copy is never the session response and the next request is a clean hit. Each response is judged on its own headers, writes are a temp file then rename, and a bypassed response never writes or deletes. The test makes sure that stays true.