smallapis

Cache and CDN

All four plugins are built to work behind page caches. Here is what to know for each one.

WebP & AVIF Offload

  • Clear the page cache once after the first conversion. Until then, cached pages keep the old HTML without the modern formats.
  • With the picture tag, the modern files have their own URLs, so every page cache and CDN works without any change.
  • With server rules, the same URL returns a different file depending on the browser. The rules send Vary: Accept, but many CDNs ignore it for images. With a CDN in front of the site, prefer the picture tag.
  • With a persistent object cache, the plugin stores its lookups there, so a page full of images costs almost nothing.

Simple Popups

  • The popup is part of the page and every timing decision happens in the visitor’s browser, so a cached page behaves exactly like an uncached one.
  • The end date is also checked in the browser: a cached page never shows an expired popup.
  • A page cached before a popup’s start date shows it once the cache is refreshed.

Private Space

  • Members-only pages, and pages using the shortcodes, tell page caches not to store them (no-cache headers and DONOTCACHEPAGE), so a member’s view is never served to someone else.
  • If a members-only page seems visible to visitors, purge it from the cache once: it was probably cached before it was marked private.

Menus are plain HTML and CSS in the page. The stylesheet loads in the page head only on pages that use a styled menu, so nothing flashes and caches need no special rule.