BlueFairy API Gateway
REST response caching, per-IP rate limiting and signed outbound webhooks — a hardened API layer for headless WordPress sites and integrations.
Install in
BlueFairy API Gateway sits in front of the WordPress REST API and does three things, each managed from one screen at Settings API Gateway.
Response cache. Anonymous GET responses are stored and served back with an X-BF-Cache: HIT header; every REST response is labelled HIT, MISS or BYPASS so you can see the decision from curl. Requests from logged-in users, or carrying an Authorization, X-WP-Nonce or X-BF-API-Key header, are never cached. Responses that are not 2xx, that stream, that set a cookie or whose Cache-Control says no-store, private, no-cache or max-age=0 are never stored. Up to 500 cache rules, each matched by route glob (wp/v2/posts/** — a trailing /** or /* matches the collection route too) with its own lifetime; the most specific matching rule wins, and one is seeded on activation as “all routes, 60 seconds”. The cache is purged automatically when a post, term or comment changes, and by hand from the Cache tab or POST /bfag/v1/cache/purge. Responses live in your persistent object cache (Redis, Memcached) when you have one, otherwise in transients — capped there at 64 KB per response and one hour, and swept every five minutes.
Rate limiting. A sliding-window counter per client IP and rule (an IPv6 client is counted by its /64 network, so rotating addresses within it does not escape the limit). The breaching request gets 429 Too Many Requests with Retry-After, X-BF-RateLimit-Limit and X-BF-RateLimit-Window. Up to 500 rules, each counting the routes its glob matches; one is seeded as 300 requests per 60 seconds across every route, and logged-in users who can edit posts are exempt by default in their own browser session (requests made with an API key or an application password are always limited). One forwarded-IP header of your choosing (X-Forwarded-For by default; CF-Connecting-IP, X-Real-IP or True-Client-IP) is honoured, and only from the proxy ranges you list, so a visitor cannot pick their own bucket. A client over the limit is refused from a marker for the rest of its window without touching the database; with a persistent object cache the count itself is an atomic increment rather than a query. The hit log is pruned every five minutes.
Signed outbound webhooks. Up to 500 webhooks, each subscribing to one event: post published, updated or deleted; user registered or updated; comment created; and, with WooCommerce, order created, order status changed, order completed, product updated. Each delivery is a JSON POST carrying X-BF-Event, X-BF-Delivery, X-BF-Timestamp and X-BF-Signature: sha256=HMAC-SHA256(timestamp.body, secret), so the receiver can verify both origin and freshness. Deliveries are collected during the request and sent once after the response — twenty at most, and for fifteen seconds at most, the rest through a WP-Cron event so a bulk import or a dead endpoint never ties up the request that saved it — logged with their HTTP status and response body, and any failed delivery can be resent from the log. Targets must be https://; a secret is generated for you and shown once, right after saving, for you to copy into the receiver.
Dashboard. Cache hit rate and webhook success rate over the last 24 hours, the current size of the rate-limit log, the ten most recent failed deliveries with a Retry button, and the same figures at GET /bfag/v1/status for a monitoring tool — a route that is never rate-limited.
Add API Gateway Pro for purges narrowed to the tags a change touches; rate limits per user and per API key with penalty blocks; DDoS auto-block with a blocked-IPs panel; automatic webhook retries with back-off and failure alerts by email; Salesforce, HubSpot and Mailchimp presets; a verified incoming-webhook endpoint (HubSpot signed; Salesforce and Mailchimp shared secret); a webhook REST API; API keys with scopes; and WPGraphQL query caching. Pro installs alongside this plugin rather than replacing it.
Documentation and testing
Tested with WordPress 7.1 on 2026-10-29: run end to end in a real browser on a clean WordPress 7.1 site with WooCommerce, Plugin Check and the Twenty Twenty-Five theme.
Admin Instructions
Everything lives under Settings API Gateway, in five tabs.
Dashboard — three cards (cache hit rate, webhook success rate for outgoing deliveries, and the Pro Active blocks count — shown as Blocked (Pro) without the add-on) recomputed every five minutes or when you press Refresh; the ten newest failed deliveries with Retry; the raw counts; and the status endpoint URL with a Copy button. Timestamps are shown in the site’s timezone.
Cache — the rules table with an Enabled/Disabled badge you can click, Edit and Delete, and Purge all. The add/edit form takes a label, a route glob (matched without the leading slash: wc/v3/products/* matches wc/v3/products and wc/v3/products/12), a TTL in seconds and optional comma-separated tags. Every content change purges every rule; with API Gateway Pro a tagged rule is purged only by the changes that touch its tags. Edit the seeded “All routes” rule to narrow it. With more than one rule the most specific one wins, and the table is listed in that order.
Rate limit — the rules table and a form with a label, Count by (IP address), a route glob, and the limit: how many requests are allowed in how many seconds. Values outside 1–65535 requests or 1–86400 seconds are refused rather than silently changed.
Webhooks — the webhooks table with Edit, Send test and Delete, the Delivery log button, and the add/edit form: label, https:// URL, event, signing secret (blank generates one and shows it once after saving), extra headers as Name: value lines, and an Enabled box. Press Send test on a new webhook: the notice reports the HTTP status, and the delivery log shows the receiver’s response under each row.
Settings — the cache switch and New-rule TTL; the rate-limiting switch, Exempt editors, Trusted proxies and Client address header; the stored-payload cap and delivery-log retention; debug logging, the WP-Cron notice switch and Delete data on uninstall. The notification email and failure threshold appear only with the Pro add-on, which is what sends the alerts.
To confirm the cache from the command line, request a public route twice and read the header: curl -sI https://example.com/wp-json/wp/v2/posts | grep -i x-bf-cache — MISS then HIT.
External services
This plugin connects to services outside your site in one way only: outbound webhooks that you configure. Nothing is sent anywhere until an administrator adds a webhook on Settings API Gateway Webhooks, and the plugin never contacts Blue Fairy Development or any other fixed address — there is no telemetry, licence check or update server.
- What it is used for: notifying another system (your own app, an automation service, a CRM relay — whatever endpoint you choose) that something happened on your site.
- Where data is sent: only to the
https://URL you enter for each webhook, and only for the one event that webhook subscribes to. Send test sends a sampletestevent to that URL when you press it. - What is sent, and when: a JSON
POSTeach time the subscribed event happens, carrying the event name, your site URL, a timestamp and the object’s allow-listed fields — for a post: id, type, status, title, slug, link, author id and dates; for a user: id, login, email, display name and roles; for a comment: id, post id, author name, author email, approval status, date and type; for a WooCommerce order: id, status, currency, total, customer id, billing email and date created; for a product: id, name, SKU, status, price and type. Each request also carries theX-BF-Event,X-BF-Delivery,X-BF-TimestampandX-BF-Signatureheaders and any extra headers you added to the webhook. - Whose terms apply: the receiving service is one you choose and control, so its terms of service and privacy policy are the ones that govern the data. Review them before sending personal data such as email addresses to it, and mention the transfer in your own site’s privacy policy where the law requires.
Written by Joobi from the project's own listing. See the source page
1.0.4
- Security: a request authenticated by an API key or application password is now always rate-limited and can be blocked, whoever the key belongs to. “Exempt editors” now covers only an editor’s own browser session. New filter
bfag_rate_limit_exempt. - Change: rate-limit rules count an IPv6 client by its /64 network, so rotating addresses within one /64 no longer escapes a limit. Devices sharing one IPv6 /64 now share one budget.
1.0.3
- Readme: the rate-limit form description is reworded. No code change.
1.0.2
- Fix: the first page load after an update could book the scheduled jobs during plugin loading, before WordPress’s
init. With WooCommerce (or another plugin that translates its cron schedule names) active, WordPress logged “Translation loading for the woocommerce domain was triggered too early”. The jobs are now booked atinit, on that same page load. - Fix: a scheduled job lost to a cron wipe or a restore (hit-log, delivery-log and cached-response pruning, the dashboard figures) is booked again on the next page load. Before, it stayed lost until the plugin was re-activated and those logs were never pruned.
1.0.1
- Up to 500 cache rules, 500 rate-limit rules and 500 webhooks — was one, one and three. The ceiling is now the same with or without API Gateway Pro, which is sold on its own features alone. The page shown when every one is in use, and the notice when a save is refused for that reason, no longer mention Pro.
- The Pro panel lists only what Pro adds, with no limit among them.
- Packaging for WordPress.org; no change to settings or data.
- The readme gains an External services section describing the outbound webhooks you configure.
- The Markdown feature reference is no longer in the plugin zip; everything it held — including the receiver signature examples and the Pro comparison — is in the features guide,
docs/ApiGatewayFeaturesGuide.pdf. - The time-limit lift used while a network-wide activation provisions every site is documented in the code.
- Screenshots retaken on this version; a sixth shows the delivery log. The features guide is rebuilt with the new dashboard and delivery-log images.
1.0.0
- First release.
- REST response cache with
X-BF-Cache: HIT/MISS/BYPASS, one route-glob rule, object-cache or transient storage (64 KB / one-hour cap on transients), generation-based purging on post, term and comment changes, Purge all, andPOST /bfag/v1/cache/purge. - Sliding-window rate limiting per IP and rule with
429,Retry-AfterandX-BF-RateLimit-*headers; one rule seeded at 300 per 60 s; editors exempt by default in a browser session (never API-key traffic); trusted-proxy IP resolution from one chosen header; refused requests served from a marker with no database work. - Up to three signed outbound webhooks on six WordPress events and four WooCommerce events, HMAC-SHA256
X-BF-Signatureovertimestamp.body, delivery after the response (twenty at most, fifteen seconds at most, the rest by WP-Cron), a delivery log with Send test and Retry on failed outgoing deliveries, payload truncation and retention pruning. - Dashboard figures recomputed every five minutes,
GET /bfag/v1/statusfor monitors, thebfag_manage_gatewaycapability, multisite provisioning. - Thirty-six
bfag_*actions and filters as the add-on contract. - Compatibility: tested against WordPress 7.1; requires PHP 8.1 or newer. Database schema version 1.0.3 (internal).
Follow this listing's changes (Atom feed)