Skip to main content

CDN for MODX Revolution

Tested on MODX Revolution 2.8.9-pl and 3.2.4-pl, PHP 8.3. The module requires PHP 7.4+, while MODX 3 requires a newer PHP version. MODX Evolution is not supported.

BranchPackage 0.1.0
Revolution 2.8zorkacdn2-0.1.0-pl.transport.zip · SHA-256
Revolution 3.xzorkacdn3-0.1.0-pl.transport.zip · SHA-256

Installation​

  1. Connect your CDN source and obtain your site's CDN URL.
  2. Upload the matching package to core/packages/ using your hosting file manager. In MODX open Extras → Installer, search for local packages and install Zorka CDN. Do not unpack the archive manually.
  3. Open System Settings, namespace zorkacdn. Set zorkacdn.origin to the canonical site URL, including its installation subfolder and trailing slash. Set zorkacdn.cdn to the issued HTTPS CDN URL, including /s/site_id.
  4. Set zorkacdn.include to public folders, one /path/ per line (default /assets/). Configure private exclusions in zorkacdn.exclude (default /assets/private/). Include the installation subfolder in paths where applicable.
  5. Test an image through the CDN, set zorkacdn.enabled to Yes and clear MODX and intermediary page caches.

Packages 2 and 3 are alternatives for their respective branches; install only one. Rewriting starts disabled. Reinstallation preserves existing settings. Test upgrades on a site copy first.

Rendering and contexts​

The OnWebPagePrerender plugin rewrites public HTML including srcset, lazy-loading and inline CSS. Repeated cached page output was tested. Stored resources, templates and original images remain unchanged.

Override zorkacdn.origin, zorkacdn.cdn, zorkacdn.include, zorkacdn.exclude and zorkacdn.enabled through context settings for multiple sites. Each source needs its corresponding issued CDN URL. Manager requests, users signed into the current context or manager, non-HTML output, POST requests and downloadable resources are skipped.

If the template uses <base href>, it must exactly match zorkacdn.origin, including the trailing slash. Unknown bases skip the whole page. Separate AJAX/JSON responses and arbitrary JavaScript strings are not rewritten.

Disabling​

Disable zorkacdn.enabled or the Zorka CDN plugin, then clear caches. Uninstalling removes the plugin, event and system settings created by the package; manually added context settings need separate removal. Original resources and images remain. MODX may preserve objects that existed before the package was installed.

Shared limitations and checks.