If your site runs behind the Sucuri Website Firewall, Sucuri keeps its own cached copy of your pages in front of your server. The Sucuri integration tells Sucuri to clear that copy whenever you clear the whole Powered Cache cache, so visitors do not keep getting old pages from the firewall.
Available in: Powered Cache Premium
Where to find it: Powered Cache → Integrations
Requires: a site protected by the Sucuri Website Firewall, and the firewall’s API key and API secret.
How the Sucuri integration works #
When you run Purge All Cache, Powered Cache sends one request to the Sucuri Firewall API with your API key, your API secret and the clear cache command. Sucuri then clears its cache for the whole site. Powered Cache waits up to 10 seconds for the answer.
Sucuri is cleared by these actions:
- Powered Cache → Purge All Cache in the admin bar.
- The Purge All Cache button in Powered Cache → Tools.
Sucuri is not cleared when Powered Cache clears single pages automatically, for example after you publish or update a post, and not by wp powered-cache purge in WP-CLI. After an important change, use Purge All Cache so the firewall picks it up right away. On multisite networks, only network administrators can run Purge All Cache.
Set up the Sucuri integration #
- Copy the API key and API secret of your site from your Sucuri Firewall dashboard.
- Go to Powered Cache → Integrations.
- Turn on Sucuri (Purge Sucuri cache).
- Paste the values into Sucuri API Key and Sucuri API Secret, or define them in
wp-config.phpinstead (see below). - Click Save Settings.
- Run Purge All Cache once to test the connection.
Settings #
Sucuri #
Turns Sucuri purging on. Default: off. Turn it on only if your domain actually points to the Sucuri Website Firewall.
Sucuri API Key and Sucuri API Secret #
The credentials Powered Cache uses for the purge request. Default: empty. Both values are stored encrypted. After you save, the fields stay empty and show Saved value. It is hidden and will remain unchanged unless you replace or clear it. To replace a value, type the new one and save. To remove it, click Clear saved value and save.
Both values are needed. If either one is missing, Powered Cache does not contact Sucuri. The credentials are never included in a settings export.
New in 4.0: Sucuri cache purging was added in Powered Cache Premium 4.0. Since 4.0.1, saved credentials show a saved state instead of sending their contents back to the browser.
Store the credentials in wp-config.php #
To keep the credentials out of the database, add them to wp-config.php above the line That’s all, stop editing!. Constants take priority over values saved in the settings screen.
define( 'POWERED_CACHE_SUCURI_API_KEY', 'your-api-key' );
define( 'POWERED_CACHE_SUCURI_API_SECRET', 'your-api-secret' );
You still need to turn on the Sucuri toggle. See wp-config constants for all constants.
Troubleshooting #
Visitors still see old pages after Purge All Cache #
Powered Cache does not show an error in the admin when the Sucuri request fails. To see what happened, turn on the debug log and run Purge All Cache again. The log then contains one of these lines:
Sucuri cache purge request sent.: Sucuri accepted the request.Sucuri cache purge failed with HTTP …: Sucuri rejected the request. Check the API key and secret.Sucuri cache purge failed: …: your server could not reach the Sucuri API. Ask your host whether outgoing HTTPS requests are blocked.
If no Sucuri line appears, the toggle is off or one of the two credentials is missing.
The credentials are gone after an import #
Exported settings files contain empty credential fields, and importing such a file clears the saved values. Enter the API key and secret again after an import, or keep them in wp-config.php.