Changeset 3765372
- Timestamp:
- 10/26/2026 12:01:42 AM (4 weeks ago)
- Location:
- nahnu-cache-connector-bunny-net
- Files:
-
- 28 added
- 4 edited
-
tags/1.0.11 (added)
-
tags/1.0.11/assets (added)
-
tags/1.0.11/assets/admin.css (added)
-
tags/1.0.11/assets/admin.js (added)
-
tags/1.0.11/assets/logo.jpg (added)
-
tags/1.0.11/assets/smartphonefield-icon.png (added)
-
tags/1.0.11/assets/wp-media-cloud.png (added)
-
tags/1.0.11/assets/wplinkcanvas-icon.png (added)
-
tags/1.0.11/assets/wpsmartconsent-icon.png (added)
-
tags/1.0.11/assets/wpsuperdocs-icon.png (added)
-
tags/1.0.11/includes (added)
-
tags/1.0.11/includes/class-wpbc-admin.php (added)
-
tags/1.0.11/includes/class-wpbc-api.php (added)
-
tags/1.0.11/includes/class-wpbc-cli.php (added)
-
tags/1.0.11/includes/class-wpbc-edge-rules.php (added)
-
tags/1.0.11/includes/class-wpbc-hooks.php (added)
-
tags/1.0.11/includes/class-wpbc-integrations.php (added)
-
tags/1.0.11/includes/class-wpbc-mainwp.php (added)
-
tags/1.0.11/includes/class-wpbc-perma-cache.php (added)
-
tags/1.0.11/includes/class-wpbc-public-api.php (added)
-
tags/1.0.11/includes/class-wpbc-purge.php (added)
-
tags/1.0.11/includes/class-wpbc-rest.php (added)
-
tags/1.0.11/includes/class-wpbc-stats.php (added)
-
tags/1.0.11/includes/class-wpbc-warmer.php (added)
-
tags/1.0.11/languages (added)
-
tags/1.0.11/readme.txt (added)
-
tags/1.0.11/uninstall.php (added)
-
tags/1.0.11/wp-bunny-connector.php (added)
-
trunk/includes/class-wpbc-admin.php (modified) (1 diff)
-
trunk/includes/class-wpbc-edge-rules.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (14 diffs)
-
trunk/wp-bunny-connector.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
nahnu-cache-connector-bunny-net/trunk/includes/class-wpbc-admin.php
r3764866 r3765372 1730 1730 [ self::RULE_STATIC_BROWSER_CACHE, 64, __( 'Long browser cache: assets', 'nahnu-cache-connector-bunny-net' ), __( '1-year browser cache for CSS, JS, images, fonts', 'nahnu-cache-connector-bunny-net' ), true ], 1731 1731 [ self::RULE_STATIC_IGNORE_QS, 65, __( 'Ignore query string: CSS/JS', 'nahnu-cache-connector-bunny-net' ), __( '?ver=6.4.1 and ?ver=6.4.2 share one cache entry', 'nahnu-cache-connector-bunny-net' ), true ], 1732 [ self::RULE_SECURITY_HEADERS, 66, __( 'Security headers', 'nahnu-cache-connector-bunny-net' ), __( 'X-Content-Type-Options, X-Frame-Options, X-XSS-Protection, Referrer-Policy, Permissions-Policy', 'nahnu-cache-connector-bunny-net' ), true ],1732 [ self::RULE_SECURITY_HEADERS, 66, __( 'Security headers', 'nahnu-cache-connector-bunny-net' ), __( 'X-Content-Type-Options, X-Frame-Options, Referrer-Policy, Permissions-Policy, Strict-Transport-Security, Content-Security-Policy (two rules; the set securityheaders.com grades on)', 'nahnu-cache-connector-bunny-net' ), true ], 1733 1733 [ self::RULE_BYPASS_SEARCH, 67, __( 'Bypass: search results', 'nahnu-cache-connector-bunny-net' ), __( '/?s=*, search is dynamic and must never be cached', 'nahnu-cache-connector-bunny-net' ), true ], 1734 1734 [ self::RULE_UPLOADS_DISABLE_OPT, 68, __( 'Disable Optimizer: uploads', 'nahnu-cache-connector-bunny-net' ), __( 'Prevents double-compression when an image optimisation plugin is active', 'nahnu-cache-connector-bunny-net' ), true ], -
nahnu-cache-connector-bunny-net/trunk/includes/class-wpbc-edge-rules.php
r3764866 r3765372 32 32 public const RULE_STATIC_IGNORE_QS = 'static_ignore_qs'; 33 33 public const RULE_SECURITY_HEADERS = 'security_headers'; 34 public const RULE_SECURITY_HEADERS_HSTS = 'security_headers_hsts_csp'; 34 35 public const RULE_BYPASS_SEARCH = 'bypass_search'; 35 36 public const RULE_UPLOADS_DISABLE_OPT = 'uploads_disable_optimizer'; … … 102 103 self::RULE_DISABLE_SHIELD_SELF => self::RULE_DISABLE_SHIELD_ADMIN, 103 104 self::RULE_SELF_DISABLE_OPT => self::RULE_ADMIN_DISABLE_OPT, 105 self::RULE_SECURITY_HEADERS_HSTS => self::RULE_SECURITY_HEADERS, 104 106 ]; 105 107 … … 1508 1510 $guids = $this->upsert_batches( self::RULE_STATIC_IGNORE_QS, '[WP Bunny] Ignore query string: CSS & JS', '', array_values( array_unique( $qs_patterns ) ), $guids, $results, 65, null, 11 ); 1509 1511 1510 // 66: Security headers 1511 $guids = $this->upsert( self::RULE_SECURITY_HEADERS, [ 1512 'OrderIndex' => 66, 'ActionType' => 5, 1513 'ActionParameter1' => 'X-Content-Type-Options', 'ActionParameter2' => 'nosniff', 1514 'TriggerMatchingType' => 0, 1515 'Description' => '[WP Bunny] Security headers', 1516 'Enabled' => true, 1517 'Triggers' => [ [ 'Type' => 0, 'PatternMatches' => array_values( array_unique( [ "https://{$h}/*", "https://{$hwww}/*" ] ) ), 'PatternMatchingType' => 0 ] ], 1518 'ExtraActions' => [ 1519 [ 'ActionType' => 5, 'ActionParameter1' => 'X-Frame-Options', 'ActionParameter2' => 'SAMEORIGIN', 'ActionParameter3' => '' ], 1520 [ 'ActionType' => 5, 'ActionParameter1' => 'Referrer-Policy', 'ActionParameter2' => 'strict-origin-when-cross-origin', 'ActionParameter3' => '' ], 1521 [ 'ActionType' => 5, 'ActionParameter1' => 'X-XSS-Protection', 'ActionParameter2' => '1; mode=block', 'ActionParameter3' => '' ], 1522 [ 'ActionType' => 5, 'ActionParameter1' => 'Permissions-Policy', 'ActionParameter2' => 'geolocation=(), microphone=(), camera=()', 'ActionParameter3' => '' ], 1523 ], 1524 ], $guids, $results ); 1512 // 66 / 66b: Security headers. 1513 // The six headers securityheaders.com grades on, split over two rules so 1514 // each stays within Bunny's per-rule action count. Values are the safe 1515 // defaults for a WordPress site: HSTS without includeSubDomains or preload 1516 // (both are sticky for a year and break HTTP-only subdomains), and a CSP 1517 // that only restricts framing and plugins. A full script/style CSP cannot 1518 // be set blindly, WordPress and most themes rely on inline scripts, so 1519 // sites that have one can replace any value via the filter. 1520 // X-XSS-Protection is no longer sent: it is deprecated, scanners flag it, 1521 // and it can introduce XSS in old browsers (OWASP recommends removing it). 1522 $headers = apply_filters( 'wpbc_security_headers', [ 1523 'X-Content-Type-Options' => 'nosniff', 1524 'X-Frame-Options' => 'SAMEORIGIN', 1525 'Referrer-Policy' => 'strict-origin-when-cross-origin', 1526 'Permissions-Policy' => 'geolocation=(), microphone=(), camera=()', 1527 'Strict-Transport-Security' => 'max-age=31536000', 1528 'Content-Security-Policy' => "frame-ancestors 'self'; object-src 'none'; upgrade-insecure-requests", 1529 ] ); 1530 $headers = array_filter( array_map( 'strval', (array) $headers ), static fn( $v ) => $v !== '' ); 1531 $set_header = static fn( string $name, string $value ): array => [ 1532 'ActionType' => 5, 'ActionParameter1' => $name, 'ActionParameter2' => $value, 'ActionParameter3' => '', 1533 ]; 1534 $header_rule = function ( string $desc, int $order, array $names ) use ( $headers, $set_header, $h, $hwww ): ?array { 1535 $actions = []; 1536 foreach ( $names as $name ) { 1537 if ( isset( $headers[ $name ] ) ) { 1538 $actions[] = $set_header( $name, $headers[ $name ] ); 1539 } 1540 } 1541 if ( ! $actions ) { 1542 return null; 1543 } 1544 $first = array_shift( $actions ); 1545 return [ 1546 'OrderIndex' => $order, 'ActionType' => 5, 1547 'ActionParameter1' => $first['ActionParameter1'], 'ActionParameter2' => $first['ActionParameter2'], 1548 'TriggerMatchingType' => 0, 1549 'Description' => $desc, 1550 'Enabled' => true, 1551 'Triggers' => [ [ 'Type' => 0, 'PatternMatches' => array_values( array_unique( [ "https://{$h}/*", "https://{$hwww}/*" ] ) ), 'PatternMatchingType' => 0 ] ], 1552 'ExtraActions' => $actions, 1553 ]; 1554 }; 1555 $rule = $header_rule( '[WP Bunny] Security headers', 66, [ 'X-Content-Type-Options', 'X-Frame-Options', 'Referrer-Policy', 'Permissions-Policy' ] ); 1556 if ( $rule ) { 1557 $guids = $this->upsert( self::RULE_SECURITY_HEADERS, $rule, $guids, $results ); 1558 } 1559 $rule = $header_rule( '[WP Bunny] Security headers: HSTS & CSP', 66, [ 'Strict-Transport-Security', 'Content-Security-Policy' ] ); 1560 if ( $rule ) { 1561 $guids = $this->upsert( self::RULE_SECURITY_HEADERS_HSTS, $rule, $guids, $results ); 1562 } 1525 1563 1526 1564 // 67: Bypass search results, never cache /?s= queries -
nahnu-cache-connector-bunny-net/trunk/readme.txt
r3764866 r3765372 1 1 === Nahnu Cache Connector for Bunny.net === 2 2 Contributors: ja1me4 3 Tags: bunny cdn, cdn, cache, purge, performance3 Tags: bunny cdn, cdn, cache, purge, waf 4 4 Requires at least: 6.0 5 5 Tested up to: 7.1 6 Stable tag: 1.0.1 06 Stable tag: 1.0.11 7 7 Requires PHP: 8.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html 10 10 11 Connects WordPress to Bunny.net CDN. Automatic cache purging, 74 edge rules, ecommerce/LMS bypass, cache warming, Perma-Cache, and CDNstats.11 Bunny.net CDN for WordPress: purge sync for 18 cache plugins, 75+ edge rules, Shield WAF bypasses, security headers, MainWP support and stats. 12 12 13 13 == Description == 14 14 15 Nahnu Cache Connector for Bunny.net connects your WordPress site to Bunny.net CDN. It syncs cache purges automatically, deploys a full set of production-ready edge rules with one click, and shows live CDN stats directly in your WordPress admin. 16 17 For full documentation visit [wpbunnyconnector.com](https://www.wpbunnyconnector.com/). 15 Nahnu Cache Connector for Bunny.net connects your WordPress site to Bunny.net CDN. It mirrors every cache purge to Bunny, deploys a complete set of production-ready edge rules for you and keeps them current, makes Bunny Shield WAF safe to run on WordPress, and shows live CDN stats in your admin. 16 17 Full documentation: [wpbunnyconnector.com](https://www.wpbunnyconnector.com/). 18 19 = Highlights = 20 21 * Purge sync for 18 cache plugins, combined into a single Bunny API call per request 22 * More than 75 edge rules covering SSL, caching, bypasses, Shield WAF and security headers 23 * Edge rules redeploy automatically whenever the plugin is updated, reinstalled or activated 24 * Bunny Shield WAF bypass for your team, protected by a per-site secret cookie 25 * All six security headers graded by securityheaders.com, set at the edge 26 * Built-in MainWP support for dashboards and child sites 27 * Works with Nahnu Login Shield to block brute-force attackers at the CDN edge 28 * Ready for WordPress 7.1 client-side media processing 29 * WP-CLI commands, REST API and PHP hooks for automation 18 30 19 31 = Automatic cache purge sync = 20 32 21 Hooks into your active cache plugin so every purge is mirrored to Bunny CDN in real time. Where possible, per-URL purges are used instead of full zone wipes.22 23 **Supported cache plugins (1 6):**33 Hooks into your cache plugin so every purge is mirrored to Bunny CDN. Per-URL purges are used where the cache plugin supports them, instead of wiping the whole zone. Purges triggered during one request (post saves, plugin, theme and core updates, cache plugin clears) are combined into one Bunny API call at the end of the request, after your local cache has finished clearing. 34 35 **Supported cache plugins (18):** 24 36 25 37 * WP Rocket … … 39 51 * RunCache (Beta) 40 52 * SWIS Performance by EWWW Image Optimizer 41 42 = 74 edge rules, one-click deploy = 43 44 Deploys a complete set of rules to your Bunny pull zone covering SSL, admin bypass, WAF bypass, ecommerce cart sessions, membership pages, LMS dashboards, static asset caching, security headers, CORS, and more. Rules are upserted and tracked by GUID — safe to redeploy at any time without duplicates. 53 * BerqWP 54 * xSpeed Cache 55 56 = Edge rules that look after themselves = 57 58 One click deploys a complete set of rules to your Bunny pull zone: HTTPS redirect, HTML caching for visitors, admin and logged-in bypasses, ecommerce, membership, LMS and booking bypasses, long browser caching for assets, query string handling, CORS for fonts, Shield WAF exceptions and security headers. Rules are tracked by GUID, so redeploying never creates duplicates, and rules you created yourself in the Bunny dashboard are left alone. 59 60 You do not have to remember to redeploy: 61 62 * Rules redeploy in the background as soon as the plugin is updated, reinstalled from a zip or activated, using the new version's code. 63 * Rules redeploy when a supported ecommerce, membership, LMS or booking plugin is activated or deactivated. 64 * A check every five minutes catches anything missed. 65 * A manual deploy always takes priority over a pending automatic one. 66 * If Bunny rejects a rule, automatic retries back off (5 minutes, 15 minutes, 1 hour, 6 hours, then daily) and the admin notice tells you which rule failed and why. 67 68 = Bunny Shield WAF, without locking yourself out = 69 70 Bunny Shield is a powerful WAF, but WordPress admin screens, the block editor and page builders send requests that WAF rules often flag. This plugin turns Shield off for those areas for your team only, and keeps inspecting everyone else. 71 72 * The bypass uses a cookie holding a per-site secret, so it cannot be forged. Rotate the secret from Settings at any time. 73 * Choose which roles get the bypass. The default is Administrator and Editor. 74 * Covers wp-admin, the REST API for logged-in users, the Bricks builder and code editor, WordPress 7.1 media processing and this plugin's own admin files. 75 * Trusted IP whitelist: turn Shield off for specific IPs or CIDR ranges, such as payment gateways, SaaS callbacks, office networks or staging servers. 76 * Shield WAF event log on the Stats tab: blocked IPs, triggered rules and URLs for the last 1, 6, 24 or 72 hours. 77 78 = Security headers = 79 80 Sets the six response headers that securityheaders.com grades on, at the Bunny edge, so they apply to cached pages too: Strict-Transport-Security, Content-Security-Policy, X-Content-Type-Options, X-Frame-Options, Referrer-Policy and Permissions-Policy. 81 82 The defaults are safe for any WordPress site. HSTS is set for one year without includeSubDomains or preload, and the Content-Security-Policy restricts framing and plugins without blocking the inline scripts WordPress and most themes rely on. Developers can replace any value with the `wpbc_security_headers` filter. 83 84 = MainWP support = 85 86 Running Bunny in front of MainWP sites can cause slow syncs, sites reported as disconnected, and duplicated update requests. The plugin handles this on both sides: 87 88 * On child sites, the MainWP dashboard's IP is detected from its own requests and added to the Shield trusted IP rule automatically, as MainWP recommends for any firewall or CDN. 89 * On the dashboard, requests to child sites running this plugin can go straight to their origin server, skipping the CDN, its WAF and its 60 second limit. Each origin is checked before use and rechecked weekly. Sites that cannot be reached directly keep using the CDN. 90 * Pull zones on MainWP sites wait the full 60 seconds for the origin and never resend a timed-out request, so a long update or sync never runs twice. 91 * The Integrations tab shows MainWP status for each site, plus server cron and timeout recommendations. 92 93 = Works with Nahnu Login Shield = 94 95 [Nahnu Login Shield](https://wordpress.org/plugins/nahnu-login-shield/) is our free login security plugin. It locks out brute-force attackers and can push their IPs to the Bunny.net WAF, so they are blocked at the CDN edge before they ever reach your server. It reuses this plugin's Bunny connection, so there is nothing extra to set up. Its status and a one-click install are at the top of the Integrations tab. 96 97 = Ready for WordPress 7.1 = 98 99 WordPress 7.1 processes images in the browser using about 13 MB of WebAssembly and JavaScript. Bunny Optimizer is kept off those files, and Shield is turned off for them for your team, so image uploads in the block editor work with Shield and Optimizer active. These rules deploy only on WordPress 7.1 and later. 45 100 46 101 = Ecommerce bypass = … … 105 160 = Multilingual support = 106 161 107 Bypass rules automatically include translated page URLs when any of these plugins is active: 108 109 * WPML 110 * Polylang 111 * TranslatePress 112 113 = Shield WAF — trusted IP whitelist = 114 115 Disables Bunny Shield WAF inspection for specific IPs or CIDR ranges entered in Settings. Useful for SaaS callbacks, office networks, staging servers, and payment gateway IPs. 162 When WPML, Polylang or TranslatePress is active, bypass rules include translated page URLs automatically, and the pull zone varies its cache by Accept-Language so each visitor gets the right language. 116 163 117 164 = Cache warmer = 118 165 119 After a full purge, a WP-Cronjob crawls your sitemap to pre-warm the CDN edge.166 After a full purge, a background job crawls your sitemap to pre-warm the CDN edge. 120 167 121 168 **Supported SEO plugins for sitemap auto-detection:** … … 132 179 = Live CDN analytics = 133 180 134 Pull zone stats, DNS stats, bandwidth breakdown, cache hit rate, and cache sync status —all inside WordPress admin.181 Pull zone stats, DNS stats, bandwidth breakdown, cache hit rate, Shield WAF events and cache sync status, all inside WordPress admin. 135 182 136 183 = Perma-Cache cleanup = 137 184 138 Deletes stale Perma-Cache files from Bunny Storage immediately after a full purge, without waiting for TTL expiry. 185 Deletes stale Perma-Cache files from Bunny Storage right after a full purge, without waiting for them to expire. 186 187 = Automation: WP-CLI, REST API and PHP hooks = 188 189 * **WP-CLI:** `wp bunny deploy`, `wp bunny purge`, `wp bunny status`, `wp bunny rules` 190 * **REST API** under `/wp-json/wpbc/v1/`: `GET /status`, `POST /purge`, `POST /purge-url`, `POST /deploy`. Authenticated with a token from Settings or a WordPress admin session. 191 * **PHP API** for other plugins: check the connection, read status, purge, deploy and reuse the Bunny connection. 192 193 The API tab in the plugin shows every endpoint, filter and action with copy-paste examples. 139 194 140 195 = Checked, no integration needed = … … 149 204 * Autoptimize, FlyWP, Redis Object Cache, Aruba HiSpeed Cache, Comet Cache, SiteGround Speed Optimizer, EWWW Image Optimizer 150 205 151 For the full compatibility list and documentation visit [wpbunnyconnector.com](https://www.wpbunnyconnector.com/). 152 153 = Developer hooks and filters = 154 155 Third-party plugins can integrate with Nahnu Cache Connector for Bunny.net without any changes to this plugin. Four filters are available. 156 157 **wpbc_shield_bypass_ips** -- add trusted IP addresses or CIDR ranges to the Bunny Shield WAF bypass list. Merged with IPs entered manually in Settings and deployed as part of rule 74. 158 159 **wpbc_shield_bypass_urls** -- disable Bunny Shield WAF inspection on specific URL path patterns. Deploys as rule 75 when any plugin uses this filter. 160 161 **wpbc_cache_bypass_urls** -- add URL path patterns to the Bunny CDN cache bypass list. Deploys as rule 76 when any plugin uses this filter. 162 163 **wpbc_compatible_plugins** -- register a plugin in the Integrations tab with a name, company, and compatibility note. 164 165 For full developer documentation and code examples visit [wpbunnyconnector.com](https://www.wpbunnyconnector.com/). 206 For the full compatibility list visit [wpbunnyconnector.com](https://www.wpbunnyconnector.com/). 207 208 = Developer hooks = 209 210 Other plugins can integrate without any changes to this plugin. 211 212 **Filters** 213 214 * `wpbc_shield_bypass_ips`: add trusted IPs or CIDR ranges to the Shield WAF bypass list. 215 * `wpbc_shield_bypass_urls`: turn Shield off for specific URL patterns. 216 * `wpbc_cache_bypass_urls`: add URL patterns to the CDN cache bypass list. 217 * `wpbc_security_headers`: change, add or remove security header values. 218 * `wpbc_compatible_plugins`: list your plugin on the Integrations tab. 219 * `wpbc_bunny_connection`: reuse the Bunny API key, pull zone and Shield zone. 220 * `wpbc_is_connected`, `wpbc_status`, `wpbc_last_purge_time`: read connection and purge status. 221 * `wpbc_watched_post_types`: choose which post types purge on save. 222 223 **Actions** 224 225 * `wpbc_purge_all`, `wpbc_purge_url`: purge the CDN. 226 * `wpbc_deploy`, `wpbc_update_rules`: redeploy edge rules. 227 * `wpbc_deploy_bypass_urls`: redeploy only the third-party bypass rules, in a few API calls. 228 * `wpbc_mark_rules_stale`: flag rules as out of date so they redeploy in the background. 229 230 Full developer documentation and examples: [wpbunnyconnector.com](https://www.wpbunnyconnector.com/). 166 231 167 232 = External services = 168 233 169 This plugin co mmunicates with the Bunny.net API (api.bunny.net) to purge cache, manage edge rules, and retrieve statistics. An active Bunny.net account and API key are required. No visitor data is transmitted. See Bunny.net Privacy Policy (https://bunny.net/privacy) and Terms of Service(https://bunny.net/tos).234 This plugin connects to the Bunny.net API (api.bunny.net) to purge cache, manage edge rules and pull zone settings, and retrieve statistics, and to Bunny Storage when Perma-Cache cleanup is enabled. An active Bunny.net account and API key are required. No visitor data is sent. See the Bunny.net [Privacy Policy](https://bunny.net/privacy) and [Terms of Service](https://bunny.net/tos). 170 235 171 236 = Disclaimer = … … 176 241 == Installation == 177 242 178 1. Upload the `nahnu-cache-connector-bunny-net` folder to `/wp-content/plugins/`, or install via **Plugins > Add New > Upload**.243 1. Install from **Plugins > Add New** by searching for "Nahnu Cache Connector", or upload the `nahnu-cache-connector-bunny-net` folder to `/wp-content/plugins/`. 179 244 2. Activate the plugin through the **Plugins** menu. 180 245 3. Go to **Settings > Bunny Connector**. 181 4. Enter your Bunny.net Account API Key and click **Test** to verifyit.182 5. Select your pull zone from the searchable dropdown.183 6. Click **Save & deploy** in the Edge Rules tab to deploy all rules to your pull zone.246 4. Paste your Bunny.net Account API Key and click **Test**. The key is saved as soon as Bunny accepts it. 247 5. Pick your pull zone from the searchable list. 248 6. Open the Edge Rules tab and click **Save & deploy**. 184 249 185 250 Your API key is the **Account API Key** found in the Bunny.net dashboard under **Account > API**, not a pull zone access key. 186 251 187 F or full setup instructions visit[wpbunnyconnector.com](https://www.wpbunnyconnector.com/).252 Full setup instructions: [wpbunnyconnector.com](https://www.wpbunnyconnector.com/). 188 253 189 254 = Defining constants (optional) = 190 255 191 Lock any value in `wp-config.php` to prevent it being stored in or changed via the database. When a constant is defined, the corresponding field is hidden in the UI.256 Lock any value in `wp-config.php` so it is not stored in, or changed through, the database. When a constant is defined, the matching field is hidden in the settings screen. 192 257 193 258 `define( 'WPBC_API_KEY', 'your-bunny-api-key' );` … … 204 269 = Does this work with any cache plugin? = 205 270 206 It integrates with 16 specific cache plugins listed above. On sites not using any of them, you can still use the edge rules, manual purge, admin bar button, and CDN stats — purges just need to be triggered manually or via the post save / plugin update triggers rather than automatically mirroring a cache plugin's hooks. 207 208 = Do the ecommerce, membership, and LMS bypass rules deploy automatically? = 209 210 Yes. Each bypass rule checks for its plugin at deploy time using `class_exists()` or `defined()`. If WooCommerce is not active, the WooCommerce rules are skipped. If MasterStudy LMS is active, its rules are deployed. No manual configuration needed. 211 212 = Does it work with WPML, Polylang, or TranslatePress? = 213 214 Yes. Bypass rules for ecommerce and membership plugins automatically include translated page URLs when any of these plugins is active. 271 It integrates with the 18 cache plugins listed above. Without one of them you can still use the edge rules, manual purge, admin bar button, CDN stats and the post save and update purge triggers. Purges just are not mirrored from a cache plugin. 272 273 = Do I need to redeploy edge rules after updating the plugin? = 274 275 No. Rules redeploy automatically in the background after every update, reinstall or activation, and a five-minute check catches anything missed. You can still deploy manually from the Edge Rules tab at any time, and a manual deploy always takes priority. 276 277 = Do the ecommerce, membership and LMS bypass rules deploy automatically? = 278 279 Yes. Each bypass rule checks for its plugin at deploy time. If WooCommerce is not active, the WooCommerce rules are skipped. When a supported plugin is activated or deactivated, rules redeploy in the background. 280 281 = Does it work with WPML, Polylang or TranslatePress? = 282 283 Yes. Bypass rules include translated page URLs, and the pull zone varies its cache by Accept-Language. 284 285 = How does the Shield WAF bypass work, and is it safe? = 286 287 When someone with a selected role logs in or opens an admin page, the plugin sets a cookie holding a secret that is unique to your site. Edge rules turn Shield off only for requests carrying that exact value, and only for admin, logged-in REST, builder and media processing URLs. Visitors are always inspected. You can choose the roles in Settings (Administrator and Editor by default) and rotate the secret at any time. 288 289 = Will this get an A on securityheaders.com? = 290 291 It sets all six headers the scanner grades on. Test both your www and non-www addresses after the rules deploy. If your site needs a stricter Content-Security-Policy, or HSTS with includeSubDomains and preload, set it with the `wpbc_security_headers` filter. 292 293 = Does it work with MainWP? = 294 295 Yes, on both the dashboard and child sites. Child sites trust the dashboard's IP in Shield automatically, the dashboard can reach child sites directly at their origin, and pull zones never resend timed-out MainWP requests. For best results use a real server cron on the dashboard and set MainWP's child request timeout to at least 300 seconds. The Integrations tab shows the status for each site. 296 297 = The Bricks code editor or WordPress 7.1 image uploads fail with Shield on. What do I do? = 298 299 Both are covered by edge rules since versions 1.0.6 and 1.0.7. Update the plugin and the rules redeploy automatically. If an Author or another role uploads media, add that role to the WAF bypass roles in Settings. 215 300 216 301 = What is Force Cache mode? = 217 302 218 Some cache plugins send `Cache-Control: max-age=0` to Bunny, which tells Bunny not to cache. Force Cache mode overrides `CacheControlMaxAgeOverride` on your pull zone so Bunny caches HTML for the configured TTL regardless of whatthe origin sends.303 Some cache plugins send `Cache-Control: max-age=0` to Bunny, which tells Bunny not to cache. Force Cache mode overrides this on your pull zone so Bunny caches HTML for the TTL you set, whatever the origin sends. 219 304 220 305 = Can I use this with Bunny Perma-Cache? = 221 306 222 Yes. Enable Perma-Cache cleanup in Settings and provide your Bunny Storage zone credentials. After every full purge the plugin lists anddeletes stale Perma-Cache files so visitors always get fresh content.307 Yes. Enable Perma-Cache cleanup in Settings and enter your Bunny Storage zone details. After every full purge the plugin deletes stale Perma-Cache files so visitors always get fresh content. 223 308 224 309 = Where do I find my Bunny API key? = 225 310 226 In the Bunny.net dashboard, go to **Account > API**. Use the **Account API Key** — not a pull zone access key. The account key is required to manage edge rules and list pull zones. 227 228 = Why do some rules in the deploy results show (1/6) or (2/6) in the name? = 229 230 Bunny's API limits each rule trigger to 5 URL patterns. Rules that cover many file extensions are automatically split into batches of 5, and each batch becomes a separate rule. The suffix shows which batch you are looking at. 231 232 = Why is the physical rule count in Bunny higher than 74? = 233 234 Batched rules each occupy multiple slots. On a site with www and non-www hostnames and all integrations active, the physical count will exceed 74. The plugin tracks all rule GUIDs and cleans up stale batches automatically when you redeploy. 235 236 = Why are LMS course and lesson pages not in the bypass rules? = 237 238 Most LMS plugins register course and lesson content as public custom post types with standard cacheable URLs. Only per-user pages (student dashboards, checkout, registration, account) need a bypass rule. The plugin makes this distinction based on each plugin's source code. 239 240 = Does the WAF bypass cookie work with MainWP one-click login? = 241 242 Yes. The `wpbc_role` cookie is set on the `set_auth_cookie` action, which fires for all login methods including MainWP, SSO plugins, and magic link plugins. 311 In the Bunny.net dashboard, go to **Account > API** and use the **Account API Key**, not a pull zone access key. The account key is needed to manage edge rules and list pull zones. 312 313 = Why do some rules show (1/6) or (2/6) in the name? = 314 315 Bunny allows 5 URL patterns per rule trigger. Rules that cover many paths or file types are split into batches of 5, and each batch is a separate rule. The suffix shows which batch you are looking at. 316 317 = Why is the rule count in Bunny higher than 75? = 318 319 Batched rules each take several slots, and some rules are added only when a matching plugin is active. On a site with www and non-www hostnames and several integrations, the count in Bunny is higher. The plugin tracks every rule and cleans up old batches when it redeploys. 320 321 = Why are LMS course and lesson pages not bypassed? = 322 323 Most LMS plugins publish courses and lessons as normal public pages that are safe to cache. Only per-user pages (student dashboards, checkout, registration, account) need a bypass, and the plugin makes this distinction for each LMS. 243 324 244 325 = Is this compatible with security plugins like Wordfence or AIOS? = 245 326 246 Yes. Security plugins operateat the request or firewall layer and are fully compatible. See the Integrations tab for the complete list.327 Yes. Security plugins work at the request or firewall layer and are fully compatible. See the Integrations tab for the complete list. 247 328 248 329 = Will NitroPack work alongside this plugin? = 249 330 250 Not as a CDN. NitroPack operates its own cloud CDN layer. Running both NitroPack CDN and Bunny CDN as proxy simultaneouslycreates a double-CDN conflict.331 Not as a CDN. NitroPack runs its own CDN, and using NitroPack CDN and Bunny CDN together creates a double-CDN conflict. 251 332 252 333 = Can my plugin integrate with Nahnu Cache Connector for Bunny.net? = 253 334 254 Yes. Four PHP filters are available so any plugin can integrate without changes to this plugin: 255 256 `wpbc_shield_bypass_ips` -- add trusted IPs or CIDR ranges to the WAF bypass list. 257 `wpbc_shield_bypass_urls` -- disable Shield WAF on specific URL paths. 258 `wpbc_cache_bypass_urls` -- add URL paths to the CDN cache bypass list. 259 `wpbc_compatible_plugins` -- register in the Integrations tab. 260 261 See full developer documentation at [wpbunnyconnector.com](https://www.wpbunnyconnector.com/). 262 263 = My plugin is not listed — can you add it? = 335 Yes. See the Developer hooks section above and the API tab inside the plugin for filters, actions, REST endpoints and examples. 336 337 = My plugin is not listed. Can you add it? = 264 338 265 339 Yes. Visit [wpbunnyconnector.com/support](https://www.wpbunnyconnector.com/support/) to request a plugin check. … … 267 341 = How is the API key stored? Is it secure? = 268 342 269 The API key is stored in the WordPress options table . It is never output in HTML, never sent to the browser in JavaScript, and never included in any AJAX response. It is sent only in HTTP request headers to the Bunny.net API. All admin AJAX endpoints require a valid nonce and`manage_options` capability.343 The API key is stored in the WordPress options table, or in `wp-config.php` if you define it there. It is never printed in the page, never sent to the browser and never included in an AJAX response. It is only sent in request headers to the Bunny.net API. Every admin action requires a valid nonce and the `manage_options` capability. 270 344 271 345 == Screenshots == 272 346 273 1. Edge Rules tab — 74 rules with enable/disable toggles, deploy button,and results table274 2. Settings tab —cache warmer and Perma-Cache cleanup configuration275 3. Settings tab — Cache-Control mode and WAF role restriction276 4. Settings tab —purge triggers and post types to watch277 5. Settings tab — Bunny API configuration and wp-config.php constants278 6. Stats tab — live CDN analytics, DNS stats,and cache sync status279 7. Manual Purge tab —full purge and per-URL purge with wildcard support280 8. Stats tab — cache hit rate, bandwidth, requests,and cache sync status detail347 1. Edge Rules tab: rules with on and off switches, deploy button and results table 348 2. Settings tab: cache warmer and Perma-Cache cleanup configuration 349 3. Settings tab: Cache-Control mode and WAF bypass roles 350 4. Settings tab: purge triggers and post types to watch 351 5. Settings tab: Bunny API connection and wp-config.php constants 352 6. Stats tab: live CDN analytics, DNS stats and cache sync status 353 7. Manual Purge tab: full purge and per-URL purge with wildcard support 354 8. Stats tab: cache hit rate, bandwidth, requests and cache sync status detail 281 355 282 356 == Privacy Policy == 283 357 284 Nahnu Cache Connector for Bunny.net does not collect or transmitany data about your site's visitors. No analytics, no tracking, no third-party data sharing.285 286 The plugin communicates with the Bunny.net API to purge cache, fetch statistics, and manage edge rules. Data sent is limited to your Bunny API key (in request headers), pull zone ID, and URLs to purge. See [Bunny.net's Privacy Policy](https://bunny.net/privacy) for details onhow Bunny.net handles this data.358 Nahnu Cache Connector for Bunny.net does not collect or send any data about your site's visitors. No analytics, no tracking, no third-party data sharing. 359 360 The plugin talks to the Bunny.net API to purge cache, fetch statistics and manage edge rules. The data sent is limited to your Bunny API key (in request headers), pull zone and Shield zone IDs, your site's hostnames and the URLs to purge. On MainWP child sites, the dashboard's IP address is added to your own Shield trusted IP rule. See [Bunny.net's Privacy Policy](https://bunny.net/privacy) for how Bunny.net handles this data. 287 361 288 362 No data is sent to Nahnu Plugins or any third party other than Bunny.net. … … 290 364 == Upgrade Notice == 291 365 366 = 1.0.11 = 367 Security headers: adds Strict-Transport-Security and a Content-Security-Policy at the edge, the full set securityheaders.com grades on. Edge rules redeploy automatically after updating. 368 292 369 = 1.0.10 = 293 MainWP: faster, more reliable syncs , plus a fix for CPU spikes and a stuck "edge rules update pending" notice after a failed automatic deploy. Child sites trust the dashboard IP in Bunny Shield automatically, the dashboard can reach child origins directly (skipping the CDN and its 60-second limit), and pull zones no longer re-send a timed-out request. Edge rules redeploy automatically after updating; sync yoursites once afterwards.370 MainWP: faster, more reliable syncs. Also fixes CPU spikes and a stuck "edge rules update pending" notice after a failed automatic deploy. Edge rules redeploy automatically after updating. Sync your MainWP sites once afterwards. 294 371 295 372 = 1.0.9 = … … 306 383 307 384 = 1.0.5 = 308 Security fix for the Shield /WAF bypass cookie. Edge rules are redeployed automatically within 5 minutes of updating; logged-in admins get the new cookie on their next admin page load. The bypass now defaults to Administrator +Editor instead of all roles.385 Security fix for the Shield WAF bypass cookie. Edge rules redeploy automatically and admins get the new cookie on their next admin page load. The bypass now defaults to Administrator and Editor instead of all roles. 309 386 310 387 == Changelog == 388 389 = 1.0.11 = 390 * Added: Strict-Transport-Security (1 year) and a Content-Security-Policy (frame-ancestors 'self'; object-src 'none'; upgrade-insecure-requests) to the security headers rule, so a site now carries all six headers securityheaders.com grades on. The CSP deliberately does not restrict scripts or styles, WordPress and most themes need inline ones; sites with their own policy can replace any value with the wpbc_security_headers filter. X-XSS-Protection is no longer sent (deprecated and flagged by scanners). 311 391 312 392 = 1.0.10 = … … 370 450 371 451 = 1.0.4 = 372 * Added: xSpeed Cache —cache purge sync via xspeed_after_purge_all (full purge).452 * Added: xSpeed Cache cache purge sync via xspeed_after_purge_all (full purge). 373 453 374 454 = 1.0.3 = 375 455 * Added: Auto-deploy edge rules when the plugin updates or a supported plugin is activated/deactivated. Runs in the background via WP-Cron 30 seconds after the trigger. Result logged to the Purge Log. 376 * Added: WP-CLI commands --wp bunny deploy, wp bunny purge, wp bunny status, wp bunny rules.456 * Added: WP-CLI commands: wp bunny deploy, wp bunny purge, wp bunny status, wp bunny rules. 377 457 * Added: Admin notice when a supported plugin is activated or deactivated confirming background rule update. Persists until the deploy completes or the admin dismisses it. 378 * Added: Public PHP API (filters and actions) for third-party plugin integration --wpbc_is_connected, wpbc_status, wpbc_last_purge_time, wpbc_purge_all, wpbc_purge_url, wpbc_deploy, wpbc_update_rules.379 * Added: REST API endpoints under /wp-json/wpbc/v1/ --GET /status, POST /purge, POST /purge-url, POST /deploy. Authenticated via X-WPBC-Token header or WordPress admin session.458 * Added: Public PHP API (filters and actions) for third-party plugin integration: wpbc_is_connected, wpbc_status, wpbc_last_purge_time, wpbc_purge_all, wpbc_purge_url, wpbc_deploy, wpbc_update_rules. 459 * Added: REST API endpoints under /wp-json/wpbc/v1/: GET /status, POST /purge, POST /purge-url, POST /deploy. Authenticated via X-WPBC-Token header or WordPress admin session. 380 460 * Added: REST API token field in Settings with copy and regenerate buttons. 381 461 * Added: API documentation tab in the plugin admin showing all REST endpoints, PHP filters, PHP actions, and integration filters with copy-paste code examples. … … 385 465 386 466 = 1.0.1 = 387 * Added: Vary Cache by Accept-Language --automatically configured on the pull zone when WPML, Polylang, or TranslatePress is active.388 * Added: Shield WAF event log panel on the Stats tab --view blocked IPs, triggered rules, and URLs for the last 1, 6, 24, or 72 hours.467 * Added: Vary Cache by Accept-Language: automatically configured on the pull zone when WPML, Polylang, or TranslatePress is active. 468 * Added: Shield WAF event log panel on the Stats tab: view blocked IPs, triggered rules, and URLs for the last 1, 6, 24, or 72 hours. 389 469 * Added: Shield Zone ID field in Settings. 390 470 * Added: Request Coalescing toggle in Settings. … … 392 472 * Updated: Tested up to WordPress 7.1. 393 473 = 1.0.0.5 = 394 * Added: wpbc_shield_bypass_ips filter —third-party plugins can add trusted IPs/CIDRs to the Bunny Shield WAF bypass list (rule 74) without any code changes to this plugin.395 * Added: wpbc_shield_bypass_urls filter —third-party plugins can disable Shield WAF on specific URL path patterns (rule 75, new).396 * Added: wpbc_cache_bypass_urls filter —third-party plugins can add URL paths to the Bunny cache bypass list (rule 76, new).397 * Added: wpbc_compatible_plugins filter —third-party plugins can register themselves in the Integrations tab.474 * Added: wpbc_shield_bypass_ips filter: third-party plugins can add trusted IPs/CIDRs to the Bunny Shield WAF bypass list (rule 74) without any code changes to this plugin. 475 * Added: wpbc_shield_bypass_urls filter: third-party plugins can disable Shield WAF on specific URL path patterns (rule 75, new). 476 * Added: wpbc_cache_bypass_urls filter: third-party plugins can add URL paths to the Bunny cache bypass list (rule 76, new). 477 * Added: wpbc_compatible_plugins filter: third-party plugins can register themselves in the Integrations tab. 398 478 399 479 = 1.0.0.4 = … … 404 484 405 485 = 1.0.0.2 = 406 * Added: BerqWP integration —berqwp_flush_all_cache and berqwp_purge_cdn (full purge), berqwp_flush_page_cache (per-URL path slug).486 * Added: BerqWP integration: berqwp_flush_all_cache and berqwp_purge_cdn (full purge), berqwp_flush_page_cache (per-URL path slug). 407 487 408 488 = 1.0.0.1 = 409 * Added: SWIS Performance by EWWW Image Optimizer integration —swis_complete_cache_cleared and swis_site_cache_cleared (full purge), swis_cache_by_url_cleared (per-URL).489 * Added: SWIS Performance by EWWW Image Optimizer integration: swis_complete_cache_cleared and swis_site_cache_cleared (full purge), swis_cache_by_url_cleared (per-URL). 410 490 * Updated: Tested up to WordPress 7.0.1. 411 491 -
nahnu-cache-connector-bunny-net/trunk/wp-bunny-connector.php
r3764866 r3765372 4 4 * Plugin URI: https://www.wpbunnyconnector.com/ 5 5 * Description: Connects WordPress cache plugins to Bunny.net CDN. Automatic purging, 75 edge rules, cache warming, Perma-Cache cleanup, and live CDN stats, all in one place. 6 * Version: 1.0.1 06 * Version: 1.0.11 7 7 * Requires at least: 6.0 8 8 * Requires PHP: 8.0 … … 13 13 * Text Domain: nahnu-cache-connector-bunny-net 14 14 * Domain Path: /languages 15 * Tested up to: 7. 015 * Tested up to: 7.1 16 16 */ 17 17 … … 46 46 } 47 47 48 define( 'WPBC_VERSION', '1.0.1 0' );48 define( 'WPBC_VERSION', '1.0.11' ); 49 49 define( 'WPBC_FILE', __FILE__ ); 50 50 define( 'WPBC_DIR', plugin_dir_path( __FILE__ ) );
Note:
See TracChangeset
for help on using the changeset viewer.