Skip to content

Index First. Scan Never.

Choose a tag to compare

@hsntgm hsntgm released this 23 Mar 09:31
630948e

🚀 Nginx Cache Purge Preload — v2.1.5

Where Single-Path Ends, Multi-Variant Begins.

🛠️ 63 files changed  |  ➕ 12,443 lines  |  ➖ 4,436 lines— Smarter. Faster. Cleaner.


✨ What's New

⚡ HTTP Purge via ngx_cache_purge (major)

The fastest purge path when the Nginx module is present.

  • Delegates single-URL purging to Nginx itself via the ngx_cache_purge module.
  • Falls back to filesystem purge automatically when the module is unavailable — existing workflow fully preserved.
  • Recommended module: community-maintained fork v2.5.x+ (not the abandoned v2.3).
  • See Help Tab → HTTP Purge for Nginx configuration details.

🗂️ Index Purge (major milestone)

Single-page purges now use a persistent URL→filepath index to skip full directory scans entirely.

  • Index is built automatically during Preload and updated after every purge via write-back.
  • Index stores an array of paths per URL — correctly handles multiple cache variants (Vary: Accept-Encoding, mobile cache entries).
  • HTTP Purge is bypassed when the index holds more than one path for a URL — all variants are removed via index loop.
  • Clear URL Index button in the Status tab for manual reset when cache paths change.

🐕 Preload Watchdog (major)

Ensures post-preload tasks run immediately when preloading finishes, without depending on visitor traffic to trigger WP-Cron.

  • Recommended for low-traffic sites, heavily cached sites, and any site using Scheduled Cache.
  • Lightweight — exits automatically once its job is done.

☁️ Cloudflare APO Sync (major)

Credit: @doctorproctor

  • Automatically mirrors every NPP purge action to Cloudflare edge cache.
  • Requires the official Cloudflare WordPress plugin with APO or Plugin-Specific Cache enabled.
  • Supports APO Cache By Device Type — sends a second purge pass with CF-Device-Type: mobile header automatically.

🔴 Redis Object Cache Sync (major)

Bidirectional sync with the Redis Object Cache plugin.

  • NPP Purge All → flushes Redis.
  • Redis flush from outside NPP → triggers full Nginx cache purge (requires Auto Purge ON).
  • Loop guard prevents infinite purge cycles between the two layers.

📊 Cache Coverage Ratio

  • Live gauge in the dashboard widget and Status tab showing Cached / Not Cached / Total counts.
  • Refreshable on demand from the dashboard widget without a page reload.
  • Based on the last completed Preload snapshot.

📱 Mobile FAB & Frontend Toast Notifications

  • Logged-in admins on mobile devices get a floating action button (FAB) with Purge and Preload actions on the frontend.
  • Purge and preload result messages now display as clean toast notifications on the frontend.

🔒 Security Milestones

  • Lazy-loaded bootstrap — NPP stays completely dormant on requests where no cache operation is needed.
  • REST API now returns 403 when disabled instead of 200.
  • Cache purge aborted if Nginx cache path overlaps WordPress installation directory. (Credit: @doctorproctor)
  • CORS wildcard headers removed from REST API endpoints.

🗑️ Removed

  • All data collection removed — opt-in tracking completely gone. NPP collects no data whatsoever.
  • Systemd service management removed — use standard system tools (systemctl) to manage the npp-wordpress FUSE mount service instead.

🧩 Where to Find Things

  • HTTP Purge setup: Settings → Advanced + Help Tab → HTTP Purge
  • Index Purge / Clear URL Index: Status Tab
  • Preload Watchdog: Settings → Preload Options
  • Cloudflare APO Sync: Settings → Advanced
  • Redis Object Cache Sync: Settings → Advanced
  • Cache Coverage Ratio: Dashboard Widget + Status Tab
  • Vary / Double Cache fix: Settings → Preload Options (warning notice) + Help Tab

🔄 Upgrade Notes

  1. Update the plugin to v2.1.5 as usual.
  2. Visit Settings — migration runs automatically on first load, cleaning up opt-in tracking data.
  3. If your Nginx has the ngx_cache_purge module, enable HTTP Purge in Settings → Advanced.
  4. Review the Vary: Accept-Encoding warning in Preload Options if you see double cache entries.
  5. ⚠️ If your Nginx cache was stored under /opt/, move it to a supported location and re-save settings — /opt/ has been removed from allowed cache path roots.

🙏 Credits

Huge thanks to everyone who tested, reported, and shared feedback. Special shout-out to @doctorproctor for the Cloudflare APO Sync and cache path safety contributions. 💙


📜 Changelog (Short)

  • Add: HTTP Purge via ngx_cache_purge module — fastest purge path with automatic filesystem fallback.
  • Add: Index Purge — persistent URL→filepath index, multi-variant support (Vary, mobile), Clear URL Index button.
  • Add: Preload Watchdog — post-preload tasks fire immediately without WP-Cron visitor dependency.
  • Add: Cloudflare APO Sync — mirrors purges to Cloudflare edge cache automatically.
  • Add: Redis Object Cache Sync — bidirectional sync between Nginx cache and Redis.
  • Add: Cache Coverage Ratio gauge in dashboard widget and Status tab.
  • Add: Mobile FAB + frontend toast notifications.
  • Add: WooCommerce Auto-Purge, Broken URLs list, server load metrics, cache size indicator, and more.
  • Security: Lazy-loaded bootstrap, REST API 403, cache path overlap protection, CORS hardening.
  • Fix: 20+ targeted fixes across purge, preload, auto-purge, filesystem, REST API, and uninstall.
  • Changed: Email template redesigned — stats dashboard with dark mode and mobile layout.
  • Changed: /opt/ removed from allowed cache paths, /cache/ added.
  • Removed: All data collection. Systemd service management from WP admin.
  • Compatibility: Tested with WordPress 6.9, PHP 8.4, Nginx 1.29.6, FUSE 3.18.2, safexec 1.9.5 and bindfs 1.18.4.