← Knowledge Base
Hosting Guides
Mitigating Layer 7 DDoS Attacks on WordPress XML-RPC
Practical XML-RPC endpoint protection using Cloudflare WAF, rate limiting and origin restrictions while accounting for legitimate integrations.
Reviewed 28 October 2026. WordPress XML-RPC is a real API endpoint that may be used by publishing clients and integrations. Blocking it indiscriminately can break legitimate workflows.1. Determine whether XML-RPC is neededWordPress documents an XML-RPC API for posts, media and other operations. Inventory mobile publishing clients, Jetpack and third-party integrations before deciding whether to restrict /xmlrpc.php. A site that does not require XML-RPC can choose to deny public requests, but any dependent integration must be tested.2. Identify malicious trafficUse edge and web-server logs to distinguish sudden spikes, repetitive POST requests, authentication failures and abnormal request rates from legitimate API usage. Do not publish sensitive tokens or raw customer IP data while investigating.3. Cloudflare WAFCloudflare documents a WP0007 rule for Jetpack-related XML-RPC requests. It also documents WP0002, a managed rule that blocks XML-RPC entirely and is disabled by default; its documentation recommends enabling full blocking as an emergency measure during attacks. Confirm the exact rule availability and behavior in your plan.4. Rate limitingApply path-scoped rate limiting to /xmlrpc.php rather than imposing indiscriminate sitewide blocks. Choose thresholds from measured legitimate traffic, with logging and dry-run/challenge where supported. Cloudflare's October 2026 rate-limiting guidance emphasizes path normalization, intended clients and rule action.5. Origin protectionFor Nginx, the official limit_req module can rate-limit requests by client address using a shared memory zone. Configure it only after identifying the actual client IP behind a trusted proxy; otherwise all Cloudflare visitors may appear as one address. Restrict direct-to-origin bypass where possible. Use ModSecurity rules only after checking installed rules and testing false positives.6. Verify and recoverConfirm ordinary WordPress browsing and all required integrations still work, review WAF events, monitor errors and adjust thresholds. During a large network flood, edge mitigation is usually more appropriate than relying only on origin PHP or application-level controls.Primary sources:https://developer.wordpress.org/apis/xml-rpc/https://developers.cloudflare.com/support/third-party-software/content-management-system-cms/wordpress-jetpack-and-cloudflare/https://developers.cloudflare.com/waf/rate-limiting-rules/best-practices/https://nginx.org/en/docs/http/ngx_http_limit_req_module.html