=== Nivoli Edge ===
Contributors: calimonk
Tags: cloudflare, security, cache, image-optimization, performance
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.72.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Security one layer above WordPress: attacks refused before PHP, locks a hacked site cannot switch off, plus pages and images from Cloudflare's edge.

== Description ==

Nivoli Edge is a security layer that lives one step above WordPress. Attacks, floods, scanners and code changes are refused at Cloudflare's edge before a request reaches PHP, and the settings that refuse them live there too, behind an email confirmation, so a hacked WordPress cannot switch them off or install anything. The same edge serves whole HTML pages and right-sized images from the node nearest each visitor, and every number shows up inside WP admin.

**Free and managed, in one sentence:** the plugin is free and GPL and everything that runs on your own server works without an account; the shields, the locks, the edge cache and the numbers need the managed edge, from 15 euro a month with a 14-day trial.

= The Edge Security layer =

Wordfence and Sucuri run inside the site they protect. This runs one layer up, at the edge, and the site cannot reach it.

**Ten shields, refused before PHP.** Your server never boots PHP to turn a request away.

* Login flood limit (10 attempts per 10 minutes per address)
* Comment flood limit (5 posts per 5 minutes per address)
* Search flood limit (30 searches per 5 minutes per address)
* XML-RPC block (a cached 410)
* Login country lock (wp-login answers only the countries you list)
* wp-admin IP lock (your own addresses, with a self-lockout guard and an email rescue)
* AI-crawler block (GPTBot, ClaudeBot, CCBot and friends; search engines never affected)
* Stray-PHP lock (every .php request except the real WordPress entry points gets a 404)
* WordPress surface lock (the REST users list, ?author=N, readme.html, license.txt, the installer, debug.log)
* Security-headers pack (HSTS, nosniff, frame and referrer policies; your own values win)

Eight of them come with every managed plan; the AI-crawler block and the wp-admin IP lock from the Growth plan up. The stray-PHP and surface locks have a monitor mode that lists what blocking would have stopped before it blocks anything.

**Three locks, nothing inside the site can turn off.** A takeover of your WordPress admin owns every plugin's settings page. Ours refuses to act on WordPress's say-so.

* Change lock: any change that weakens protection waits for a click on a link mailed to the license holder; the link applies exactly that change, once.
* Install lock: plugin and theme installs, uploads, updates, deletes and the file editors are refused site-wide until a 15-minute window is opened the same way. Automatic updates and WP-CLI run on the server and are never affected.
* Origin lock: the edge stamps a per-site secret on every request it forwards and the plugin refuses code changes that arrive without it, so knowing the server's address is no longer a way around the locks. A self-test reports whether the server enforces it.

**Evidence: who did what, from where.**

* Refused installs named by plugin, and every refused attempt in your inbox as it happens.
* A lock activity log with time and address for every unlock request, clicked link, confirmation and lock change.
* An attack-surface strip per fortnight, a monthly report by email, and for agencies a posture matrix across every site.

Underneath all of it, Cloudflare's managed WAF rulesets, including the WordPress rule set, run in front of every managed site.

= Pages served from the edge =

Full-page HTML caching with surgical purge: only the pages featuring a changed post refresh, never the whole cache.

* Surrogate-Key / Cache-Tag headers on every cacheable page; purges go to Nivoli, Fastly, Cloudflare Enterprise or your own webhook.
* Logged-in visitors, carts and checkout always bypass.
* Stylesheets, scripts and fonts from the edge too, on versioned addresses, so no browser or CDN node holds a stale file after a purge.
* Origin shield: if your server goes down, the edge keeps serving the last good copy of every cached page for up to 7 days and emails you when it engages and when the origin recovers.

= Images served from the edge =

URLs rewrite through Cloudflare Image Resizing into right-sized WebP/AVIF variants on the fly. No uploads, no duplicate copies, no migration, no theme changes.

* Per-size presets, one-click Size mapping from your theme's registered sizes, a catch-all for everything else.
* Broken, heavy and fake images found from real traffic, with where each is used and one-click fixes; heavy originals shrink through Tinify.

= The numbers, inside WP admin =

* What the edge answered and what it refused, by window, with the most-requested and most-missed URLs.
* Dead URLs on a Recent 404s page with one-click redirect or block; a Search Console 404 export imported, matched to your own pages and turned into redirect and block rules family by family; All rules: one ordered list of every edge rule with per-rule counts and reordering.
* Audience without a tracking script: humans versus bots, countries, referrers, devices, served-from-cache speed.
* Static assets: edge hit rate per file type and which files still travel on plain addresses.
* A monthly report by email, white-label copies for clients on Business and up.

= Free versus managed =

Free, on your own infrastructure, no account: image URL rewriting through your own Cloudflare zone (native WP filters, srcset, Gutenberg, WooCommerce, the_content and full-page scan), image rules and size mapping, page-cache tag headers with surgical purge to Fastly, Cloudflare Enterprise or your webhook, prewarm on save, coverage audit with a weekly regression email, fake-image detection and repair, purge-failure alerts, a weekly header self-test, a printable client report, the debug overlay, and WP-CLI.

Managed, with a Nivoli API key: everything in The Edge Security layer above, the managed page cache and image CDN (no Cloudflare account, plan or DNS work), origin shield, URL rules and the 404 inbox, per-path cache duration, the query-param manager, cache protection, dynamic-content safety for WooCommerce, edge insights and the monthly report, custom image hostname and watermarking, and for agencies a fleet console with one key across sites.

= Requirements =

* **Free:** a Cloudflare zone with **Image Resizing** enabled for the image half (Pro+ plan or per-1000 pricing); a tag-aware edge (Fastly / CF Enterprise / your webhook) for the page-cache half. If Image Resizing isn't enabled the rewritten URLs 404; the Tools tab has a one-click probe to verify.
* **Managed:** none of the above; the managed edge provides both. Just an API key from your Nivoli account.

== Installation ==

1. Upload the plugin and activate it (or paste your API key on the **Managed Edge** tab; the managed edge provisions itself and fills the settings in for you).
2. Free / bring-your-own-zone: open **Nivoli Edge → Settings**, confirm the auto-detected image host + path prefix, toggle Enabled.
3. Add rules under **Image rules** if specific sizes need specific treatment, or let **Size mapping** create them from your theme's registered sizes in one click. Catch-all handles the rest with zero config.
4. For HTML caching, open **Settings → Page cache** and pick a backend (managed Nivoli with your API key, or your own Fastly / CF Enterprise / webhook).
5. The **Dashboard** shows whether everything's working and what the edge is doing for you.

== Frequently Asked Questions ==

= Does this require Cloudflare Pro? =

Cloudflare Image Resizing is bundled with Pro plans or available as per-1000-transforms pay-as-you-go. Either is fine.

= Will this break my theme? =

No. The plugin only modifies URLs at the filter boundary; the HTML structure your theme outputs is unchanged. Use the `no-cf` CSS class on any element to opt out.

= How is this different from Smush / ShortPixel / Optimole? =

Those plugins compress and re-host images on their own CDN. Nivoli Edge transforms on the fly from your origin: no asset duplication, no migration step, no storage bill.

= What's the difference between Free and Managed? =

Everything the plugin does on your own server is free and fully functional: image rewriting, page-cache purging, audits, prewarming, alerts, reports. Nothing phones home. An API key connects the plugin to the Nivoli managed edge: we run the Cloudflare zone and page cache for you (no Cloudflare setup at all) and the service adds what a plugin alone can't, such as edge-side usage statistics, per-URL traffic insights, edge URL rules and security shields, custom hostnames, watermarking, and multi-site fleet management.

= What if I lose access to my license email? =

Confirmation and unlock links go to the email address on your Nivoli license and nowhere else; that is what makes the locks hold against a takeover. Support can move the license to a new address after verifying you own it. Until then the locks stay as they are and the site keeps running; only changes that weaken protection wait.

= Does the install lock break automatic updates? =

No. Automatic background updates run from wp-cron on your server and WP-CLI runs on the box; neither passes through the edge, so neither is affected. Only installs, uploads, updates and deletes started from wp-admin are refused, and you open a 15-minute window by email when you want to do one yourself.

= What if my site gets hacked anyway? =

The locks stop the intruder from switching the shields off, installing anything through WordPress, or redirecting the confirmation address, and every attempt lands in your inbox and on the Locks page with its time and address. What no edge control can do is undo code already running on your server: cleaning the box is still yours (scan, restore, rotate). The locks make sure the compromise stays where it landed.

= Does the page caching conflict with my security plugin (Wordfence, Sucuri)? =

No. Different layers: security plugins inspect requests inside WordPress/PHP; Nivoli Edge's ten shields run at Cloudflare's edge, before the request reaches your server. It sheds junk traffic so your origin and your security plugin only see real visitors. They complement each other.

= Do I need to change my nginx / web-server config? =

Only if your origin runs its own micro-cache (nginx fastcgi/proxy cache, Varnish) and you use the manual purge trigger; the Cache protection pane shows the exact one-line snippet. A standard PHP-FPM origin needs no server changes at all.

== External services ==

The free tier's core image rewriting sends **no data to any external service**; it only rewrites `<img>` URLs in your site's HTML so browsers fetch through your own Cloudflare zone. Beyond that, the plugin contacts external services only for the specific, opt-in features listed below.

**Nivoli managed edge** (api at html-caching-admin.nivoli.workers.dev, dashboard at console.nivoli.com): used **only if you enter an API key**. On activation and on a daily background re-check it sends your API key, this site's URL, the plugin version, and the list of broken-image file paths you have marked handled (so the monthly report can exclude them; these are addresses the CDN already sees in its own traffic) to validate the key and provision your managed CDN/page-cache tenant; it then reads back the aggregate usage statistics shown on the dashboard. If you configure monthly reports or alerts, the recipient email address and optional report branding (a name and logo URL) are stored with your account. No visitor data is ever sent. Terms: https://nivoli.com/terms · Privacy: https://nivoli.com/privacy

**Cloudflare** (api.cloudflare.com): used **only if you configure the Cloudflare Enterprise page-cache backend** with your own API token, to dispatch tag-based cache purges when your content changes. Terms: https://www.cloudflare.com/terms/ · Privacy: https://www.cloudflare.com/privacypolicy/

**Fastly** (api.fastly.com): used **only if you configure the Fastly page-cache backend** with your own API token, to dispatch surrogate-key purges on content change. Terms: https://www.fastly.com/terms/ · Privacy: https://www.fastly.com/privacy/

**TinyPNG / Tinify** (api.tinify.com): used **only if you add your own Tinify API key and click "Shrink original"** on an image, to compress that source file. Only the image you choose is sent. Terms & Privacy: https://tinify.com/terms

== Screenshots ==

1. Dashboard: what the edge did for you in the last 30 days. Delivered, Protected and your plan at work, with 30-day trends.
2. Edge shields: the attack surface strip (XML-RPC, logins, AI crawlers, comment and search floods) and every shield with its switch, enforced before your server.
3. Locks: change lock and install lock, what they refused (by plugin), the wp-admin IP lock and login country lock, and the lock activity log with time and address.
4. Lock activity: what the locks refused in the last 14 days, the exact plugin someone tried to install or update, and the log of who unlocked what, when, from which address.
5. PHP & surface shields: stray PHP and enumeration or leftover requests refused, with off, monitor and block for each.
6. Stats and overview: hour-by-hour traffic, origin offload, hit rates by window, surgical purges.
7. Heaviest images: the files costing the most bandwidth, one-click Tinify shrinking, and what the shrinking has saved so far.
8. Redirects: legacy URLs answered at the edge, patterns and exact rules with usage, unused rules folded away.
9. Recent 404s: paths your server keeps answering with a 404, with bot share and one-click redirect or block.
10. Your audience: humans versus bots, served-from-cache speed, referrers, devices and countries, no tracking script.
11. Static assets: edge hit rate for stylesheets, scripts and fonts, versioned addresses, bandwidth offloaded.
12. Query params: which parameters split the cache, which are guarded, with one-click collapse.

== Changelog ==

Recent releases are listed below. The full history for every version is in CHANGELOG.md, which ships with the plugin, and on the GitHub releases page.

= 1.72.2 =
Copy on a DNS record's name copies what the DNS host wants typed: _acme-challenge, _cf-custom-hostname, or @ for the domain itself. The full name stays readable next to it.

= 1.72.1 =
The DNS records that put a site behind the edge come as two phases, the same as the guided page: prove ownership and get the certificate first (an ownership TXT and the permanent certificate-delegation CNAME; live traffic untouched), then route traffic (the site's CNAME, unlocked once the certificate is active). One record per card, Copy on name and value, the certificate state remembered between checks.

= 1.72.0 =
After the key is activated, an onboarding overview on the account pane and the Dashboard walks the six steps to a site live behind the edge: key, images (test, then switch), pages behind the edge (one click, then the two DNS records inline with copy buttons and a check), shields, locks, the report. Each step shows its state and its button; the card steps aside once the site is live with the locks on. The activation notice is one sentence.

= 1.71.1 =
The Security check lives under Tools for every install, Never-loading images under Images. A free install's Managed Edge tab shows Your account only until the site is connected. The own-zone column on the Dashboard is a checked list; each security finding separates what the managed edge does from what to do on the server.

= 1.71.0 =
Two free tools. Security check: what this WordPress exposes (XML-RPC, readable usernames, the code editors, missing security headers, version disclosure, readme.html, debug.log, directory listing, a user named admin, HTTPS), five of them fixable from the pane with one click, every finding paired with what the managed edge does about it before PHP. Heaviest uploads: the largest image originals on disk with a one-click Tinify shrink.

= 1.70.6 =
The client report is a managed feature now (it is built on edge numbers) and leaves the Tools rail on free installs. The free tools card leads with surgical cache purges for your own CDN and says what they do.

= 1.70.5 =
The coverage audit on an install with no image pipeline configured shows a proper empty state with the way forward instead of a Run button that fails with a yellow warning; the fresh Dashboard's tools card no longer offers it.

= 1.70.4 =
Free installs get a Tools you can use now card on the Dashboard: never-loading images (posts referencing files that no longer exist), fake images, the coverage audit, size mapping, page-cache purging and the client report, each one click away. They were all there, spread over three tabs.

= 1.70.3 =
The own-zone path on the fresh-install Dashboard lists what the free plugin does on your own infrastructure (image rewriting, rules and size mapping, page-cache purging, prewarm, audits, fake-image repair, alerts, client report, WP-CLI) instead of only what it lacks.

= 1.70.2 =
A fresh install now opens on one decision: put the site behind the managed edge (three steps: trial, key, two DNS records) or use your own Cloudflare zone for images only. The account pane connects in the same three steps on one card, and the features list is a full-width tile grid.

= 1.70.1 =
The free install's Managed Edge pane and the Dashboard checklist now describe what the managed edge is (a security layer above WordPress: shields before PHP, locks a takeover cannot undo, pages and images from the edge, numbers measured there) instead of pitching an image CDN.

= 1.70.0 =
Query params: the Dynamic card has an Add a dynamic param field. A filter that exists but has had no traffic yet could not be kept dynamic before, because the only button for it sat on a row in the collapsed list, and a row needs traffic. Type the name, Keep dynamic, done; the edge picks it up within a minute.

= 1.69.0 =
Upgrade in place: on a managed install every Upgrade plan button now opens your Stripe billing portal on the plan-change step, so the plan changes on the subscription you already have, prorated, with the same key. Licenses not on Stripe land on the pricing page with the key carried along. Add a transform pack lands on the pack section of the pricing page, which moved up above the plan cards.

= 1.68.2 =
All rules is three columns now: number, rule, controls. Each rule shows its pattern on one line and, under it, what it does (301 redirect to a target, or block 410), whether it matches the query string, and how often it fired in the chosen window. Nothing left to squeeze.
