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.
| Branch | Package 0.1.0 |
|---|---|
| Revolution 2.8 | zorkacdn2-0.1.0-pl.transport.zip · SHA-256 |
| Revolution 3.x | zorkacdn3-0.1.0-pl.transport.zip · SHA-256 |
Installation
- Connect your CDN source and obtain your site's CDN URL.
- 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. - Open System Settings, namespace zorkacdn. Set
zorkacdn.originto the canonical site URL, including its installation subfolder and trailing slash. Setzorkacdn.cdnto the issued HTTPS CDN URL, including/s/site_id. - Set
zorkacdn.includeto public folders, one/path/per line (default/assets/). Configure private exclusions inzorkacdn.exclude(default/assets/private/). Include the installation subfolder in paths where applicable. - Test an image through the CDN, set
zorkacdn.enabledto 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.