Block at the edge with Bunny.netUpdated
Normally, Shield blocks attackers at your server. Edge blocking goes one step further. When Shield catches an attacker, it also tells Bunny.net to block that IP at the Bunny edge, so the attacker’s later requests never reach your server at all.
This topic is for sites that already serve their traffic through Bunny.net (a pull zone). If you don’t use Bunny, skip it. Cloudflare has its own topic.

What it does#
When a trigger fires, Shield sends the offending IP to Bunny, and Bunny stops requests from that IP before they reach you. Where the IP goes depends on your pull zone:
- Your pull zone has Bunny Shield. The IP goes to a Shield access list named Nahnu Login Shield lockouts. Shield takes it off the list when the lockout ends or when you unlock the IP. See “Bunny Shield”.
- Your pull zone has no Shield, or Bunny refuses the list. The IP goes to the pull zone’s IP block list as a timed rule. Bunny removes that rule itself when the Block duration is up.
You choose which events trigger it:
- Honeypot username: someone tried to log in with a username on your trap list. (On by default.)
- Brute-force lockout: an IP went over the failed-attempt limit and was locked out. (On by default.)
Shield still locks the IP out locally as usual. The Bunny block is added on top. The push runs in the background, usually within a minute of the lockout. From version 1.0.19, lockouts that happen close together are sent together: one list update for a Shield access list, or one request per IP for the pull zone’s block list.
Before you start#
You need:
- A site served through a Bunny.net pull zone.
- Bunny Shield or IP blocking available on that pull zone. Bunny’s plans and features change, so check your Bunny account.
- Your Bunny.net account API key.
Set it up#
- Go to Settings → Nahnu Login Shield and open the Edge Blocking tab. Stay on the IP Blocking sub-tab.
- In the Bunny.net WAF card, turn on Enable Bunny WAF blocking.
- Enter your API key. Get it from the Bunny dashboard under Account → API. The field has a link to it.
- Click Save Bunny WAF settings. This saves the key and loads your pull zones.
- Under Pull Zone, search for and click your site’s pull zone. The page shows its ID underneath once chosen.
- Set the Block duration: how long Bunny keeps each block on the pull zone’s IP block list, from 1 to 8760 hours. The default is 24 hours. Blocks on a Shield access list follow the lockout instead.
- Under Trigger on, tick Honeypot username, Brute-force lockout, or both.
- Click Save Bunny WAF settings.
- Click Test connection. A success message means Shield can talk to your pull zone. An error tells you if the key is wrong, or the pull zone ID wasn’t found.
The card’s badge shows where you stand: Not configured (no key), Key saved, choose a zone, Configured, not enabled (switch off), or Active.
Keep the API key out of the database#
The API key you paste in is saved in your site’s settings. For safety, the tab recommends putting the key and pull zone in wp-config.php instead:
define( 'NAHNLS_BUNNY_API_KEY', 'your-key-here' );
define( 'NAHNLS_BUNNY_PULL_ZONE_ID', 123456 ); When these are set, the tab shows “Set in wp-config.php” in place of the fields.
Treat your API key like a password#
A Bunny account API key can do a lot more than add IP blocks: it’s the key to your Bunny account. Anyone with it can change your CDN. Don’t share it, and don’t paste it into support tickets or screenshots.
If an IP is blocked by mistake#
What to do depends on where the block is. Check the Provider column in the edge block log.
- Bunny Shield (the Shield access list): unlock the IP on the Lockout tab (see “Unlock an IP”). This clears the lockout and takes the IP off the list in Bunny. Clicking Unblock on its row in the edge block log or on the Bunny Shield tab also removes it from Bunny, but leaves the local lockout in place.
- Bunny.net (the pull zone’s IP block list): Shield can’t remove this rule. Delete the IP block rule for the pull zone in your Bunny dashboard, or wait for it to expire. Then remove the lockout in Shield as usual (see “Unlock an IP”). For these rows, Unblock only removes the entry from Shield’s list.
To avoid blocking yourself, keep your own IP in the Whitelisted IPs list (Lockout tab). Whitelisted IPs are never locked out, so they are never pushed to Bunny.
What gets logged#
Each push is recorded in the edge block log, with the IP, the provider (Bunny Shield for the Shield access list, Bunny.net for the pull zone’s IP block list), the reason and the expiry time. See “The edge block log”. If Bunny rejects a request, Shield writes the error to your server’s PHP error log with the prefix [NAHNLS].
Good to know#
- Single IPs here. Lockouts send one IP each. To block a whole network (AS number), use Block network… (see “Bunny Shield”).
- How long the block lasts. On a Shield access list the block ends when the lockout ends, or when you unlock the IP. Expired IPs are removed by an hourly task, so it can take up to an hour more. Block duration applies only to the pull zone’s IP block list, where the block lasts that long even if the lockout is shorter.
- Needs WP-Cron. The push is sent by a background WordPress task. If WP-Cron is disabled on your site and not replaced by a real cron job, pushes may be delayed.
- Bunny must see the real IP. Shield reads the visitor’s IP the same way as for lockouts. Behind Bunny, turn on Trust proxy headers (Lockout tab), or Shield may send Bunny’s own IP instead of the attacker’s.
- Requests that never reach WordPress can’t be logged by Shield. Bunny’s own logs will show them.
Was this helpful?
Thanks for your feedback!
✓ Feedback received. Thank you!