User

CDN with BunnyCDN

One-click image and asset CDN per domain. The panel creates a BunnyCDN Pull Zone and rewrites asset URLs in your HTML on the fly — no plugin or code change needed.

Last updated 1775692800

Opterius Panel includes a built-in CDN integration with BunnyCDN. With one click, any domain can be accelerated by serving static assets (images, CSS, JS, fonts, videos) from BunnyCDN's global edge network instead of from your origin server.

The integration works for any site — WordPress, Laravel, plain HTML, custom CMS — without installing a plugin or modifying any files. The panel configures Nginx to rewrite asset URLs in your HTML responses on the fly.

Why a CDN?

Serving static assets from a CDN gives you four immediate wins:

  1. Faster pages — assets load from the edge node closest to each visitor instead of from your one origin server
  2. Lower origin bandwidth — your hosting bandwidth bill drops because the CDN absorbs most asset traffic
  3. Better Core Web Vitals — Google ranks fast sites higher, and CDN reduces LCP and INP metrics
  4. DDoS absorption — BunnyCDN absorbs traffic spikes that would overwhelm a small origin server

For an image-heavy site (typical WordPress with photos), a CDN often cuts page load time by 50% or more.

Prerequisites

The administrator must configure the BunnyCDN API key once, in System Settings → Integrations. Each customer can then enable CDN per domain without needing their own BunnyCDN account — the panel uses the admin's account on behalf of customers.

If you're the administrator, get your API key from dash.bunny.net/account/api-keys and paste it into the Integrations settings page.

Enabling CDN for a Domain

  1. Open CDN in the sidebar (under the Performance section).
  2. Find the domain you want to accelerate.
  3. Click Enable CDN.
  4. Wait a few seconds — the panel creates a BunnyCDN Pull Zone for your domain and configures Nginx.
  5. The status flips to "CDN active via your-zone.b-cdn.net" and asset URLs are now being rewritten.

That's it. Visit your site in a browser and inspect any image — its src should now point to https://your-zone.b-cdn.net/... instead of https://your-domain.com/....

How URL Rewriting Works

The panel does not modify any files on your server. Instead, the agent writes a small Nginx configuration include that uses the sub_filter directive to rewrite asset URLs in HTML, CSS, JavaScript, and JSON responses on the fly.

For example, if you have an image at /wp-content/uploads/2026/photo.jpg, the rewriter swaps it like this:

Before After
https://example.com/wp-content/uploads/2026/photo.jpg https://opterius-example-com.b-cdn.net/wp-content/uploads/2026/photo.jpg
/wp-content/uploads/2026/photo.jpg https://opterius-example-com.b-cdn.net/wp-content/uploads/2026/photo.jpg

The rewriting happens at response time, so:

  • Your files on disk are never touched
  • Disabling CDN reverts everything instantly with no cleanup needed
  • No plugin or theme is required
  • It works for any CMS, framework, or hand-written PHP

Default Rewrite Paths

By default, Opterius rewrites URLs that start with these paths:

/wp-content/
/wp-includes/
/assets/
/static/
/storage/

These cover the asset directories of every common CMS:

  • WordPress: wp-content and wp-includes
  • Laravel: storage (public symlink)
  • Most static-asset workflows: assets, static

You can customize the path list per domain on the CDN page. Just edit the textarea, add or remove paths, and click Save paths. Each path must be in the format /folder/ (leading and trailing slash).

Purging the Cache

When you update a file, the CDN may still serve the old cached version for up to several hours. To force the CDN to fetch the latest version, click Purge on the CDN page.

The next visitor will trigger a fresh fetch from your origin, and BunnyCDN will store the new version at every edge node worldwide.

You should purge the cache after:

  • Updating a WordPress theme or plugin that ships new CSS/JS
  • Replacing an image with the same filename
  • Pushing a new build of a JavaScript/CSS bundle

Disabling CDN

Click Disable on the CDN page. The panel:

  1. Calls BunnyCDN to delete the Pull Zone
  2. Removes the Nginx include file
  3. Reloads Nginx

Asset URLs immediately stop being rewritten and your site reverts to direct serving. You can re-enable at any time — a new Pull Zone is created with the same name.

How It Works Under the Hood

When you enable CDN for example.com:

  1. Panel creates a BunnyCDN Pull Zone via the BunnyCDN API:
    • Name: opterius-example-com (the prefix is configurable per panel install)
    • Origin URL: https://example.com
    • Pulls assets on demand the first time each one is requested by a visitor
  2. Agent writes /etc/nginx/opterius-includes/example.com-cdn.conf with sub_filter directives for each rewrite path
  3. Nginx is reloaded and starts rewriting matching URLs in HTML/CSS/JS responses

The Nginx vhost template already includes /etc/nginx/opterius-includes/{domain}-*.conf via a wildcard include, so the new file is picked up automatically without modifying the vhost itself.

Pricing

BunnyCDN charges per GB of bandwidth and per million requests, billed to the panel administrator's BunnyCDN account. Pricing is published at bunny.net/pricing — at the time of writing, it starts at around $0.005 per GB in Europe and North America, which is significantly cheaper than Cloudflare Pro for asset-heavy sites.

The panel administrator decides how to charge customers for CDN usage. Common models:

  • Free with the hosting plan: include CDN as a feature on every plan, eat the cost
  • Per-plan upgrade: enable CDN only on Business / Datacenter plans
  • Pay-as-you-go: track BunnyCDN usage per domain via the BunnyCDN dashboard and bill customers separately

The panel doesn't yet enforce per-plan limits — that's a planned addition.

Limitations

  • HTML rewriting requires Nginx serving the response. Pages served by external services (e.g. an iframe to a third-party form) are not rewritten because Nginx never sees them.
  • Compressed responses are decompressed first. The agent disables upstream compression so sub_filter can read the response body. Nginx then re-compresses on the way out, so visitor-facing performance is unchanged.
  • No edge rules. This integration uses a basic Pull Zone with default settings. Advanced features like cache rules, image optimization, and edge headers must be configured manually in the BunnyCDN dashboard.
  • One Pull Zone per domain. Subdomains of the same parent domain each get their own zone. This keeps zones isolated but uses more BunnyCDN API quota.
  • No traffic analytics in the panel yet. To see bandwidth, request count, and cache hit rate, log in to dash.bunny.net.

Troubleshooting

"CDN integration is not configured by the administrator." The admin hasn't entered a BunnyCDN API key. Tell them to add it in System Settings → Integrations.

"BunnyCDN error: ..." when clicking Enable The API key might be invalid or the Pull Zone name is already taken. BunnyCDN zone names are globally unique across all customers. Change the Zone Name Prefix in the admin settings to something more unique (e.g. your company name).

Site loads but assets are still served from the origin domain. Hard refresh the page (Ctrl+Shift+R) — your browser may have cached the old HTML. Then check the Network tab in DevTools to confirm assets are now loading from *.b-cdn.net.

Some assets still load from the origin. The rewrite paths might not cover them. Check the Rewrite paths textarea on the CDN page and add the missing path (e.g. /uploads/, /files/).

Images load slowly the first time, then fast. That's how a CDN works. The first request for each asset is a "cache miss" — BunnyCDN fetches it from your origin and stores it at the edge. Subsequent requests are served from the edge, which is much faster. Wait a few minutes after enabling CDN for the cache to warm up.

I see "Mixed content" warnings about HTTP assets. The rewriter only handles https:// and root-relative paths. If your site has hardcoded http://example.com/... links somewhere, those won't be rewritten and will trigger mixed-content warnings. Update them to https:// or root-relative paths.

My site uses Cloudflare in front of Opterius. Will this still work? Yes, but the chain becomes Cloudflare → Opterius → BunnyCDN → Origin. This adds latency. If you're already using Cloudflare in front of your origin, you don't need the Opterius CDN integration — Cloudflare's CDN already covers asset acceleration.