Edge Cache Marker logoEdge Cache Marker is a free Joomla 5 / 6 system plugin that sets a marker cookie on editor login so upstream edge caches โ€” Cloudflare Cache Rules, SiteGround Dynamic Cache, Fastly, Bunny, Varnish, NGINX proxy_cache, any CDN with cookie inspection โ€” can bypass cached HTML for authenticated editor sessions while still serving cached HTML at edge speed to everyone else. Public visitors get the ~30 ms edge-hit TTFB the cache is there to deliver; logged-in editors keep seeing every SP Page Builder edit pencil, Joomla inline pencil, module edit icon, and template edit icon in their overlay.

Why this exists

The moment you put a full-HTML edge cache in front of a Joomla site, editor UX breaks. TTFB drops from ~200 ms to ~30 ms for anonymous visitors โ€” a huge win. But logged-in editors visit their pages and every inline edit icon is gone, because the edge is serving them the same anonymous-user render everyone else gets. The obvious fix โ€” bypass on "any Joomla session cookie" โ€” over-corrects: Joomla starts a session for every anonymous contact-form submitter, so cookie-based bypass wipes out cache-hit ratio for the entire audience. Edge Cache Marker fires only on onUserAfterLogin, only for users in the configured editor groups. Registered-only members reading paywalled articles don't trigger the marker. Anonymous form submitters don't trigger the marker. Only real editors do โ€” cache-hit ratio stays maximal, editor overlays come back.

How it works

On onUserAfterLogin, if the logging-in user is in one of the configured editor groups (default: Author, Editor, Publisher, Manager, Administrator, Super Users), the plugin writes a session-scoped cs_edit_session=1 cookie. Your CDN's cache rule inspects the cookie and bypasses cache when it's present. On onUserAfterLogout, the plugin sends an expired cookie so the browser clears the marker. Nothing in Joomla renders differently; the plugin doesn't touch the response body. It's ~200 lines of PHP that just sets and clears one cookie at the right two moments.

What you configure

System โ†’ Manage โ†’ Plugins โ†’ search "csedgecachemarker".

FieldDefaultWhat it controls
Cookie namecs_edit_sessionThe name your edge-cache bypass rule looks for.
Cookie value1The value your rule matches against.
Editor user groupsAuthor, Editor, Publisher, Manager, Administrator, Super UsersOnly members of these groups get the marker on login.
Cookie lifetime (seconds)00 = session cookie (dies when the browser closes). Set to a positive value to make the marker persist across restarts.
SameSiteLaxAuto-downgrades from None to Lax on HTTP requests.
HttpOnlyOffKeep off unless you're sure no client-side JS needs to read the marker.
Debug loggingOffOptional INFO-level log lines to the plg_system_csedgecachemarker category.

The other half โ€” the edge-cache rule

The plugin only sets the cookie. Your CDN or reverse proxy is what actually bypasses cache when it sees the cookie. Copy the snippet that matches your edge:

Cloudflare Cache Rule โ€” append to your existing cache-eligibility expression:

and not (http.cookie contains "cs_edit_session=1")

SiteGround Dynamic Cache โ€” add to .htaccess:

SetEnvIf Cookie "cs_edit_session=1" no-cache=1

Varnish VCL:

sub vcl_recv {
    if (req.http.Cookie ~ "cs_edit_session=1") {
        return (pass);
    }
}

NGINX proxy_cache:

map $http_cookie $skip_cache {
    default 0;
    "~*cs_edit_session=1" 1;
}
proxy_cache_bypass $skip_cache;
proxy_no_cache $skip_cache;

Fastly VCL:

if (req.http.Cookie ~ "cs_edit_session=1") {
    return(pass);
}

Installing it

  1. Download the ZIP above.
  2. Joomla admin โ†’ System โ†’ Install โ†’ Extensions โ†’ Upload Package File โ†’ drop the ZIP.
  3. The plugin auto-enables on install โ€” no need to visit the Plugins page.

Then add the corresponding rule snippet at your CDN or reverse proxy from the section above, log out of Joomla, log back in, and confirm the cs_edit_session=1 cookie appears in your browser's dev tools. On the next request your CDN should return Cf-Cache-Status: BYPASS (or equivalent) for your session while still returning HIT for anonymous visitors.

What to check after enabling

Whenever this plugin is enabled on an already-live CF-fronted site there's a small transitional window โ€” the moment between "plugin enabled" and "editors log out and log back in" โ€” where authenticated pages can get cached by CF with the editor's overlay HTML baked in. After that first re-login purge your edge cache once so any polluted responses evict. From that point on, every editor request carries the marker cookie, edge caches skip caching those responses, and only anonymous responses ever land in the cache.

Requirements

Joomla 5.0 or later (5.x and 6.x), PHP 8.1 or later. The plugin is a system plugin using Joomla's namespaced service-provider pattern; it does not run on Joomla 4 or older.

Open source

Edge Cache Marker is open source under GPL-2.0-or-later. The full source, issue tracker, and release downloads live at github.com/cybersalt/cs-edge-cache-marker.


Interesting blog? Like it on Facebook, Post it or share this article on other bookmarking websites.

Written by:
Tim Davis is the founder and owner of Cybersalt.
Log in to comment

Add comment

Submit