Edge Cache Defensive mode is now available on all WP Cloud hosts and may be managed via WP-CLI and the WP Cloud Atomic API.
While the WP Cloud platform provides DDoS mitigations, WP Cloud’s Edge Cache Defensive mode offers an additional on-demand layer of protection.
Utilizing proof-of-work, Defensive mode issues a challenge to browsers visiting the site, mitigating spam bot and DDoS attack requests. Legitimate users will briefly see a challenge page while their browser completes the work before accessing the site.
This feature can be enabled for durations ranging from 30 minutes to 7 days.
For WP Cloud hosting partners, documentation for this feature is available in the WP Cloud Field Guide. A copy of the documentation, as it is today, is below.
Example Usage
To use Defensive mode, Edge Cache must be enabled on the selected site and a request to enable Defensive mode for a period of time must be passed.
Defensive mode’s WP-CLI option supports minutes, hours, and days with a minimum of 30 minutes and a maximum of 7 days. Via the WP Cloud Atomic API, a timestamp that is at least 30 minutes into the future and does not exceed 7 days may be set.
Managing Edge Cache & Defensive Mode via WP-CLI
This update brings multiple edge cache WP-CLI commands.
wp edge-cache
usage: wp edge-cache defensive_mode [--time=<time>] [--end]
or: wp edge-cache disable
or: wp edge-cache enable
or: wp edge-cache purge
or: wp edge-cache status
Enable Defensive Mode
wp edge-cache defensive_mode –-time=<time>
- Enable for 35 minutes:
wp edge-cache defensive_mode --time=35m - Enable for 2 hours:
wp edge-cache defensive_mode --time=2h - Enable for 3 days:
wp edge-cache defensive_mode --time=3d
Disable Defensive Mode
wp edge-cache defensive_mode --end
Checking Defensive Mode Status
wp edge-cache status
Managing Defensive Mode via the WP Cloud Atomic API
WP Cloud hosts may control, and provide user-facing options for, Defensive mode via the WP Cloud Atomic API.
Enable Defensive Mode
curl -H “Auth: $AT_AUTH_TOKEN” -d ‘timestamp=1718019551’ https://atomic-api.wordpress.com/api/v1.0/edge-cache/$SITE_ID/ddos_until
Disable Defensive Mode
curl -H “Auth: $AT_AUTH_TOKEN” -d ‘timestamp=0’ https://atomic-api.wordpress.com/api/v1.0/edge-cache/$SITE_ID/ddos_until
Checking Defensive Mode Status
A GET request to theedge-cache endpoint will return the status of edge cache and defensive mode. ddos_until provides when the defensive challenge mode will expire in the Unix timestamp format. 0 represents that the mode is disabled and any previous usage has expired.
curl -H ‘Auth: API_AUTH_TOKEN’ -X GET https://atomic-api.wordpress.com/api/v1.0/edge-cache/example.com
Example of Defensive Mode Active
{
"message": "OK",
"data": {
"status": 1,
"status_name": "Enabled",
"ddos_until": 1719951098
}
}
Example of Defensive Mode Inactive
{
"message": "OK",
"data": {
"status": 1,
"status_name": "Enabled",
"ddos_until": 0
}
}