Protecting WordPress REST APIs Under Load With Durabl
Image Source: depositphotos.com
WooCommerce integrations, mobile apps, and headless front ends often rely on custom WordPress REST API routes, which most sites serve under /wp-json/. Unless a response is cached, PHP handles each API request and may run database queries, so a burst of API traffic can impact the most demanding parts of the WordPress stack.
Swiss company Trafficmind offers the free Durabl WordPress security plugin to control this traffic from within WordPress by applying rate limits, source controls, and firewall policies to REST API requests. Because hostile, excessive, and legitimate requests often share endpoints, the plugin has to tell them apart while keeping access open for integrations and trusted users.
Legitimate, Excessive, and Hostile Traffic on the Same Routes
Much of this traffic is legitimate, such as a JavaScript front end retrieving content or the block editor saving a post. Other requests are excessive without being malicious, like an integration checking for updates every second or a scraper paging repeatedly through /wp-json/wp/v2/posts.
A third category, hostile traffic, probes for weaknesses directly, for example by delivering injection payloads to a custom route or enumerating usernames through the users endpoint. Since one endpoint can receive all three at once, a single site-wide rule is too broad. The comparison table below pairs each category with its own response.
| Traffic type | Typical source | What it looks like | Suitable response |
| Editor and front-end requests | Headless front ends, authors | Consistent volume on familiar paths | Allow, exempting trusted networks from strict limits |
| Partner integrations | Inventory or payment services | Fixed IP ranges sending predictable bursts | Allow traffic from listed networks |
| Aggressive polling | Poorly configured apps | One route receiving a high request rate | Rate limit, then a short timed block |
| Content scraping | Automatic paging clients | Rotating user agents, sequential page parameters | Bot scoring plus a rate limit |
| Username enumeration | Automated reconnaissance | Repeated requests to /wp-json/wp/v2/users | Block with a path-based policy |
| Injection attempts | Exploit scanners | Malicious payloads in JSON or query strings | Block with OWASP rules |
Request Policies Built From Path, Method, and Source
To separate these categories, the Durabl WAF checks every request's source, method, and path before the REST API handler runs, so each route can receive a suitable policy. For example, /wp-json/shop/v1/orders might take POST requests exclusively from a fulfillment partner while leaving GET requests open to anyone.
To enforce that split, a custom rule combines the HTTP method with the path and confines write requests to that partner's IP range. Beneath such rules, the Durabl.net dashboard provides controls for the OWASP Core Rule Set, including the anomaly threshold and rule groups. The threshold sets the amount of suspicious evidence a request may build up before enforcement starts.
For APIs, this threshold needs care, because legitimate JSON bodies can contain characters, operators, or strings that look like attack syntax. Per-rule event counts show whether the threshold is matching valid payloads or catching real injection attempts.
Rate Limits Sized to Each Endpoint
Excessive traffic needs a different control, because individual requests may be harmless while their combined frequency strains the database, upstream services, and PHP. Each rate limit in Durabl.net covers a defined resource scope and pairs a measurement window with a request threshold.
Requests within the scope are counted during that window, and once they exceed the threshold, the enforcement action applies for a set duration. The action then expires on its own, so a client that slows down regains access.
Observed traffic, not guesswork, determines effective limits, usually in this order:
- A baseline for each route comes first, drawn from real request counts.
- Each scope stays narrow, so a limit on one expensive write or search endpoint does not restrict inexpensive content reads.
- The threshold sits above the highest volume expected from any legitimate client, with trusted partner networks excluded where high volume is normal.
- Enforcement duration starts short and increases only on routes where abusive clients return as soon as a block expires.
Source Controls and the Trust Placed in an IP Address
Alongside rate limits, IP access controls can restrict, block, or allow selected addresses and networks, which suits both known abusive ranges and partner allowlists. Behind a reverse proxy, however, these controls may act on the proxy's address instead of the visitor's unless forwarded client data is trusted only from known infrastructure.
To handle this, Durabl.net offers trusted-proxy configuration and source-IP detection, with known proxies listed in CIDR ranges so that only listed proxies can supply forwarded client addresses. The verified source address then feeds AI Bot Detection, which merges detection inputs into a bot-confidence score between 0 and 100.
Stable addresses make source controls most effective, which is why automated clients such as scrapers are harder to handle. These clients can spread requests across networks, change user agents, and rotate IPs, so the plugin compares the bot-confidence score with a configured protection threshold. Reputation data from providers like Spamhaus ZEN adds another signal to request frequency and observed behavior.
Choosing Between Allow, Challenge, Block, and Observe
Once a request is assessed, the WAF can observe, block, challenge, or allow it, depending on the client that uses the endpoint. A challenge suits browser-facing traffic because a real browser can pass it, while machine clients and scripts calling JSON endpoints usually cannot, so timed blocks fit them better.
For a new custom rule, it’s practical to start in observe mode, which logs matches without disrupting traffic. Administrators can check whether the rule would catch a trusted integration before it starts enforcing. Beyond observe mode, manual mitigation, timed blocks, and temporary challenges can run alongside automatic score-based controls.
The Event Trail Behind Each Decision
Whenever the WAF acts, it creates a security event recording the request context and why the decision was made. In REST API investigations, these fields are most useful:
- Enforcement status and action, showing the request's outcome and whether its mitigation is still active.
- OWASP classification and triggered WAF rule, identifying the rule and providing the basis for tuning the anomaly threshold.
- Host, method, and path, separating abuse of a custom endpoint from broader pressure across /wp-json/.
- User agent, country, and source IP, revealing whether one integration or many distributed clients caused a spike.
- Request volume and bot score, explaining how an automated client exceeded a threshold while each request looked normal.
Durabl Intelligence uses these events to correlate live attack activity with installed plugins and their versions. If exploit traffic hits a vulnerable plugin's REST route, it can be connected to the responding controls and the related vulnerability record. Patch status and protection status are tracked separately, so a blocked exploit does not hide the fact that the plugin needs an update.
Because the plugin acts inside WordPress, requests reach the server before the plugin evaluates them. When volume exceeds what the origin should handle, Trafficmind Edge Protection, an optional paid service, can shift enforcement to an edge network of more than 120 points of presence. Its API abuse controls and edge WAF filter unwanted traffic upstream of the WordPress origin, while administrators manage protection from the Durabl.net dashboard.
Under normal conditions at /wp-json/, rate limits drawn from measured baselines and narrowly scoped path policies keep expensive requests in check without interrupting legitimate API clients. The event records then supply the evidence to investigate abnormal behavior, understand each intervention, and adjust these controls as traffic changes.