How to Deploy Astro to Bunny.net: Step-by-Step Guide
Deploy Astro to Bunny.net with edge storage, a bash deploy script, GitHub Actions CI/CD, caching, security headers, and a full cost breakdown. Under $1/mo.
Last updated: 22 min read

Disclosure: this guide contains referral links. If you buy through them, I may earn a commission at no extra cost to you.
You built an Astro site. It’s fast, it’s static, and now you need to deploy Astro to Bunny.net without paying for a server or babysitting infrastructure. Bunny gives you edge storage with global replication and a CDN with 119+ points of presence. You upload your built files, Bunny serves them from the nearest edge location to every visitor. No VPS to patch, no Nginx config to debug, no Docker container to babysit.
I run my own Astro site on Bunny.net, and after months of using it in production I can say the setup is straightforward once you know the steps. I wrote a full Bunny.net review after 1 year covering CDN pricing, Stream, and how it compares to Cloudflare. This guide does one thing: walk you through getting your Astro static site deployed and live on Bunny.net.
If you don’t have an Astro site yet, I covered how to build a free blog with Astro using the Bitdoze Astro Theme. The same setup applies here, just swap Cloudflare Pages for Bunny.net hosting.
Try Bunny.net free for 14 days
You can follow along with this guide without spending anything. Sign up at Bunny.net with no credit card required and get a full 14-day free trial.
What you need before starting
- An Astro site configured for static output (or fork the Bitdoze Astro Theme to follow along)
- A Bunny.net account (free 14-day trial, no credit card)
- Node.js v22.23.4 or higher installed on your machine (Astro’s current requirement; odd-numbered releases like v23 are not supported)
- A domain name (optional, but recommended for production)
Why Bunny.net for static site hosting
A quick aside on why this is worth doing before we get into the setup.
- No server maintenance. Upload files, Bunny serves them. No OS updates, no security patches.
- Edge storage replication. Your site files live in multiple regions worldwide, not a single data center.
- Perma-Cache stores content permanently on edge servers when your origin is an external server. For this setup your files already live on Bunny storage (details in Step 5).
- Storage starts at $0.01/GB, bandwidth at $0.01/GB in EU/NA. Most blogs run for under $1/month.
- Let’s Encrypt certificates are provisioned automatically. No certbot, no renewal cron jobs.
- Custom domains with full DNS control. Bring your own domain and Bunny handles the rest.
Here’s how Bunny.net stacks up against other popular static hosting options:
| Feature | Bunny.net | Cloudflare Pages | Netlify | Vercel |
|---|---|---|---|---|
| Bandwidth price (EU/NA) | $0.01/GB | Free (limited) | $0.10/GB | $0.15/GB |
| Storage price | $0.01/GB | Free (limited) | Included | Included |
| Edge locations | 119+ | 300+ | ~100 | ~100 |
| Custom domain | Free | Free | Free | Free |
| Free tier | 14-day trial | Yes (generous) | 100GB/mo | 100GB/mo |
| WAF / DDoS protection | Bunny Shield (free tier) | Included | Add-on | Add-on |
| Min. monthly cost | $1 | $0 | $0 | $0 |
Approximate overage rates as of July 2026. Verify current pricing on each provider’s site.
Cloudflare Pages has the better free tier if cost is your only concern. If you want to deploy an Astro blog on Cloudflare, I covered that separately. But if you want edge storage replication, predictable pricing at scale, or you already use Bunny for CDN or video, hosting your Astro site there keeps everything in one dashboard. I switched from Cloudflare Pages to Bunny for exactly that reason.
Volume Network for bandwidth-heavy sites
If your site pushes serious traffic, Bunny’s Volume Network serves from 10 PoPs at $0.005/GB (first 500 TB), half the standard rate. For a typical blog it’s overkill, but it’s good to know the option exists.
Step 1: Build your Astro site
This guide targets Astro v7.x. The build workflow hasn’t changed across versions, but the config has, specifically around output modes.
Confirm static output in astro.config.mjs
Open astro.config.mjs and confirm it looks something like this:
import { defineConfig } from 'astro/config';
export default defineConfig({
site: 'https://yourdomain.com',
// output: 'static' is the default, no need to specify it
// For SSR routes, use output: 'server' and add an adapter
});Astro uses static output by default. Unless you explicitly set output: 'server', you’re already set. (Astro v5 removed the hybrid output mode: output: 'static' and hybrid merged, and per-route opt-out is now done with export const prerender = false on individual pages, which requires an adapter.)
If your build is slow, look into Astro build speed optimization before deploying. You can also migrate Astro to Bun for faster builds if you want to squeeze more out of your CI pipeline.
Build the site:
npm run buildThis generates a dist/ folder containing your complete static site: HTML files, CSS, JavaScript, images, everything. You can preview it locally to verify everything looks right:
npm run previewThe dist/ folder is what we’ll deploy to Bunny.net.
Step 2: Set up Bunny.net infrastructure
You need two things on the Bunny.net side: a storage zone (where your files live) and a pull zone (the CDN layer that serves them to visitors). Neither takes more than a couple of minutes.
Create a storage zone

- Log into your Bunny.net dashboard
- Go to Storage in the left sidebar
- Click Add Storage Zone
- Fill in the details:
- Name: Something like
my-astro-site(this becomes part of the storage URL) - Main Region: Pick the region closest to your primary audience (e.g.,
DEfor Europe,NYfor US East) - Replication Regions: Add regions where you want copies of your files (e.g., add
NYandSYDif you have visitors in the US and Australia) - Tier: Edge tier (SSD) doubles the per-GB cost ($0.02 vs $0.01/GB for Standard HDD) but remains negligible for small sites and adds better performance. For a 500 MB blog, that’s the difference between $0.005 and $0.01 per month.
- Name: Something like
Bunny offers free traffic to Bunny CDN when serving from Bunny Storage. No bandwidth charge for the storage-to-CDN hop. That’s a real cost advantage over setups like S3 + CloudFront where you pay for both storage egress and CDN bandwidth.
Choose regions carefully
You cannot change the main region or remove replication regions after creating a storage zone. You can add replication regions later, but start with your primary audience’s region and add more as needed.
Create a pull zone

The pull zone is the CDN configuration that sits in front of your storage zone and serves files to visitors.
- In your newly created storage zone, go to Connected Pull Zones
- Click Connect Pull Zone
- Configure it:
- Name: Something like
my-astro-site(this becomesmy-astro-site.b-cdn.net) - Zones: Select the geographic zones you want to serve traffic from (EU, NA, Asia, etc.)
- Name: Something like
That’s the basic infrastructure. Your pull zone hostname (my-astro-site.b-cdn.net) is already live and will serve whatever is in your storage zone. Right now that’s nothing, so let’s fix that.
Step 3: Deploy your site
The deployment uploads files from your dist/ folder to Bunny Storage via the Bunny API, then purges the CDN cache. You can do this from your local machine or automate it with GitHub Actions.
Get your credentials
You need four values from the Bunny dashboard:
- Storage Zone Name: The name you chose when creating the storage zone (e.g.,
my-astro-site) - Storage Password: Go to Storage → your storage zone → FTP & API Access → copy the Password
- Pull Zone ID: Go to Pull Zones → your pull zone → check the URL, it contains the pull zone ID (or find it in the pull zone settings)
- Account API Key: Go to Account Settings → copy the API Key

Deploy Script (Local)
Write the Bunny.net deploy script
Create a .env file in your project root (add it to .gitignore so you don’t commit secrets):
# .env
BUNNY_STORAGE_ZONE=your-storage-zone-name
BUNNY_STORAGE_PASSWORD=your-storage-zone-password
BUNNY_PULL_ZONE_ID=your-pull-zone-id
BUNNY_API_KEY=your-account-api-keyThen create the deploy script. Save it as deploy.sh in your project root:
#!/bin/bash
set -euo pipefail
# Load environment variables from .env
if [ ! -f .env ]; then
echo "Error: .env file not found. Copy .env.example to .env and fill in your credentials."
exit 1
fi
set -a
source .env
set +a
# Validate required variables
for var in BUNNY_STORAGE_ZONE BUNNY_STORAGE_PASSWORD BUNNY_PULL_ZONE_ID BUNNY_API_KEY; do
if [ -z "${!var:-}" ]; then
echo "Error: $var is not set in .env"
exit 1
fi
done
DIST_DIR="dist"
# Build the site
echo "Building Astro site..."
npm run build
# Collect file list into a temp file to avoid pipe subshell issues
FILE_LIST=$(mktemp)
trap 'rm -f "$FILE_LIST"' EXIT
find "$DIST_DIR" -type f > "$FILE_LIST"
total=$(wc -l < "$FILE_LIST")
echo "Uploading $total files to Bunny Storage..."
failed=0
count=0
while IFS= read -r file; do
count=$((count + 1))
remote_path="${file#$DIST_DIR/}"
encoded_path=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$remote_path'))")
printf " [%d/%d] Uploading: %s" "$count" "$total" "$remote_path"
http_code=$(curl -s -o /dev/null -w "%{http_code}" -X PUT \
"https://storage.bunnycdn.com/$BUNNY_STORAGE_ZONE/$encoded_path" \
-H "AccessKey: $BUNNY_STORAGE_PASSWORD" \
--data-binary "@$file" || true)
if [ "$http_code" -eq 201 ] || [ "$http_code" -eq 200 ]; then
echo " -> OK"
else
echo " -> FAILED (HTTP $http_code)"
failed=$((failed + 1))
fi
done < "$FILE_LIST"
echo "Upload complete: $((count - failed))/$count succeeded."
if [ "$failed" -gt 0 ]; then
echo "Warning: $failed file(s) failed to upload."
fi
# Purge CDN cache
echo "Purging CDN cache for pull zone $BUNNY_PULL_ZONE_ID..."
http_code=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
"https://api.bunny.net/pullzone/$BUNNY_PULL_ZONE_ID/purgeCache" \
-H "AccessKey: $BUNNY_API_KEY" || true)
if [ "$http_code" -eq 200 ] || [ "$http_code" -eq 204 ]; then
echo "Cache purged successfully."
else
echo "Warning: cache purge returned HTTP $http_code"
fi
echo "Deployment complete!"Make it executable and run it:
chmod +x deploy.sh
./deploy.shThe script builds your Astro site, uploads every file from dist/ to Bunny Storage using the storage API, then purges the CDN cache so visitors see the fresh version immediately.
Deploy script doesn't remove deleted files
The script only uploads. It never deletes. If you remove a blog post or rename a CSS file, the old file stays in Bunny Storage and may still be served from cache. Three ways to handle this: (A) delete the storage zone contents via API (DELETE https://storage.bunnycdn.com/{zone}/) before uploading, (B) use the ayeressian/bunnycdn-storage-deploy GitHub Action with remove: "true" (see the GitHub Actions tab), or (C) accept the staleness. Astro’s _astro/ assets are hash-fingerprinted, so stale files don’t break anything. Only old HTML pages linger.
If you prefer a Node.js-based deploy script, Bunny publishes an official TypeScript SDK: @bunny.net/storage-sdk (v0.3.2 as of July 2026). It handles retries, typed responses, and programmatic listing/deletion. Useful if you want to solve the stale-file problem inside your own script.
GitHub Actions (Automated)
To deploy automatically on every push to main, use the same approach in a GitHub Actions workflow.
Set up secrets
Go to your GitHub repository → Settings → Secrets and variables → Actions and add these secrets:
| Secret name | Value |
|---|---|
BUNNY_STORAGE_ZONE |
Your storage zone name |
BUNNY_STORAGE_PASSWORD |
Your storage zone password (from FTP & API Access) |
BUNNY_PULL_ZONE_ID |
Your pull zone ID |
BUNNY_API_KEY |
Your account API key |
Create the GitHub Actions deploy workflow
Create .github/workflows/deploy.yml:
name: Deploy to Bunny.net
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: lts
- name: Install dependencies
run: npm ci
- name: Build site
run: npm run build
- name: Upload to Bunny Storage
env:
BUNNY_STORAGE_ZONE: ${{ secrets.BUNNY_STORAGE_ZONE }}
BUNNY_STORAGE_PASSWORD: ${{ secrets.BUNNY_STORAGE_PASSWORD }}
run: |
DIST_DIR="dist"
total=$(find "$DIST_DIR" -type f | wc -l)
echo "Uploading $total files to Bunny Storage..."
count=0
failed=0
while IFS= read -r file; do
count=$((count + 1))
remote_path="${file#$DIST_DIR/}"
encoded_path=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$remote_path'))")
printf " [%d/%d] Uploading: %s\n" "$count" "$total" "$remote_path"
http_code=$(curl -s -o /dev/null -w "%{http_code}" -X PUT \
"https://storage.bunnycdn.com/$BUNNY_STORAGE_ZONE/$encoded_path" \
-H "AccessKey: $BUNNY_STORAGE_PASSWORD" \
--data-binary "@$file" || true)
if [ "$http_code" -ne 201 ] && [ "$http_code" -ne 200 ]; then
echo " -> FAILED (HTTP $http_code)"
failed=$((failed + 1))
fi
done < <(find "$DIST_DIR" -type f)
echo "Upload complete: $((count - failed))/$count succeeded."
if [ "$failed" -gt 0 ]; then
echo "Error: $failed file(s) failed to upload."
exit 1
fi
- name: Purge CDN cache
env:
BUNNY_PULL_ZONE_ID: ${{ secrets.BUNNY_PULL_ZONE_ID }}
BUNNY_API_KEY: ${{ secrets.BUNNY_API_KEY }}
run: |
http_code=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
"https://api.bunny.net/pullzone/$BUNNY_PULL_ZONE_ID/purgeCache" \
-H "AccessKey: $BUNNY_API_KEY")
if [ "$http_code" -eq 200 ] || [ "$http_code" -eq 204 ]; then
echo "Cache purged successfully."
else
echo "Warning: cache purge returned HTTP $http_code"
fiEvery push to main now triggers: install dependencies, build the Astro site, upload all files to Bunny Storage, purge the CDN cache. Fully automated. (ubuntu-latest currently resolves to Ubuntu 24.04.)
Simpler alternative: bunnycdn-storage-deploy action
If you don’t want to maintain inline bash, the ayeressian/bunnycdn-storage-deploy action handles upload, stale-file removal, cache purge, and retries in one step:
- name: Deploy to BunnyCDN
uses: ayeressian/[email protected]
with:
source: "dist"
storageZoneName: "${{ secrets.BUNNY_STORAGE_ZONE }}"
storagePassword: "${{ secrets.BUNNY_STORAGE_PASSWORD }}"
accessKey: "${{ secrets.BUNNY_API_KEY }}"
pullZoneId: "${{ secrets.BUNNY_PULL_ZONE_ID }}"
upload: "true"
remove: "true"
purgePullZone: "true"
purgePullZoneDelay: "5"
maxRetries: "5"The remove: "true" flag solves the stale-file problem the raw script has.
Verify your deployment
Don’t assume the deploy worked. Check it.
- Check the site is live:
curl -sI https://your-pull-zone.b-cdn.net/index.html | head -5. ExpectHTTP/2 200 - Check content renders:
curl -s https://your-pull-zone.b-cdn.net/index.html | grep "<title>". Expect your page title - Check cache headers:
curl -sI https://your-pull-zone.b-cdn.net/index.html | grep -i "cache\|hit\|miss\|age". A fresh deploy should showAge: 0or a cache MISS on first request - Verify a CSS/JS asset loads:
curl -sI https://your-pull-zone.b-cdn.net/_astro/your-hash.css | head -5. ExpectHTTP/2 200andcontent-type: text/css
If the site returns 404, your files aren’t at the root of the storage zone. If assets return 404, check that the full dist/ folder was uploaded (including the _astro/ subdirectory). If you see stale content, the cache purge didn’t fire. Do it manually from the dashboard.
Step 4: Configure your custom domain
Your site is already accessible at your-pull-zone.b-cdn.net, but you probably want your own domain. Here’s how.
Add the hostname in Bunny
- Go to Pull Zones → your pull zone → General
- Scroll to Hostnames
- Click Add Custom Hostname
- Enter your domain (e.g.,
www.yourdomain.comoryourdomain.com) - Click Add
Bunny generates an SSL certificate automatically (usually within a few minutes).
Configure DNS at your registrar
How you configure DNS depends on whether you’re using a subdomain or the root domain.
For a subdomain (e.g., www.yourdomain.com):
Add a CNAME record:
| Type | Name | Value |
|---|---|---|
| CNAME | www | your-pull-zone.b-cdn.net |
CNAME records are the standard approach. They route traffic through Bunny’s Anycast network efficiently.
For a root domain (e.g., yourdomain.com):
Add an ANAME (also called ALIAS) record:
| Type | Name | Value |
|---|---|---|
| ANAME / ALIAS | @ | your-pull-zone.b-cdn.net |
Not all DNS providers support ANAME records. Cloudflare, DNSMadeEasy, and Bunny’s own DNS do. If yours doesn’t, use a subdomain like www with a CNAME instead, then set up a redirect from the root domain to www.
CNAME vs ANAME for root domains
ANAME records resolve to an IP address at the DNS level, which can slightly reduce routing optimization compared to CNAME. If performance matters more than a clean root domain URL, use www with a CNAME record instead. Bunny has a detailed writeup on how ANAME records affect CDN routing if you want the technical details.
Verify and enforce SSL
- Wait for the SSL certificate status to change to Active (check the Hostnames section in your pull zone)
- Toggle Force SSL to redirect all HTTP traffic to HTTPS
- Verify by visiting
https://yourdomain.comin a browser
DNS propagation
DNS changes can take anywhere from a few minutes to 48 hours to propagate globally, though most updates show up within 15-30 minutes. You can check propagation status with dig or online DNS checkers.
Step 5: Configure caching
Bunny has three caching features worth understanding for a static Astro site. They work together in layers.
Smart Cache
Smart Cache is enabled by default on pull zones accelerated by Bunny DNS. It decides what gets cached and what passes through to the origin on every request.
For static sites, Smart Cache caches everything with a recognized static file extension (images, fonts, CSS, JS, PDFs, etc.) and never caches text/html, application/json, or application/xml MIME types. This is the right behavior for most Astro sites since your HTML pages will be fetched fresh while assets get cached.
If you need to cache HTML pages (Bunny excludes them by default), create an Edge Rule with the Override Cache Time action targeting your HTML files.
Vary Cache
Vary Cache lets Bunny store different versions of the same URL based on factors like browser capabilities, device type, or location. The relevant options for a static Astro site:
| Setting | What it does |
|---|---|
| WebP support | Serves WebP images to browsers that support them, original format to the rest |
| AVIF support | Same idea, but for the AVIF format |
| URL Query String | Treats different query strings as separate cached files |
Watch your cache cardinality
Each Vary setting multiplies the number of cached versions per URL. WebP + AVIF + Mobile/Desktop creates 2 x 2 x 2 = 8 cached versions of each file. Only enable settings you actually need, or your cache hit rate drops.
Perma-Cache
Perma-Cache is a secondary permanent cache layer between the CDN and your origin. When a cache miss occurs on the CDN edge, Bunny checks Perma-Cache storage first before hitting your origin. Files that get fetched from the origin are stored permanently in Perma-Cache in the background.
This is different from regular CDN caching, which expires based on time or available space. Perma-Cache files stick around indefinitely.
Perma-Cache vs Storage Zone origin
If your pull zone is directly connected to a storage zone as its origin (which is the setup in this guide), Perma-Cache is not available because your content is already hosted on Bunny storage. Perma-Cache is useful when your origin is an external server (a VPS, for example) and you want Bunny to cache origin responses permanently.
To enable Perma-Cache:
- Create a separate storage zone (different from the one holding your site files)
- Go to Pull Zones → your pull zone → Caching → Perma-Cache
- Select the storage zone from the dropdown
- Save configuration
Step 6: Add security with Bunny Shield
Bunny Shield is Bunny’s WAF (Web Application Firewall) and DDoS protection service. It sits in front of your pull zone and filters malicious traffic before it reaches your site. There’s a free tier that covers the basics.
What the free tier gives you
The free Shield tier includes 71 built-in WAF rules, 2 rate limit rules, and DDoS protection. It blocks common attacks automatically:
- SQL injection attempts in query parameters and forms
- Cross-site scripting (XSS) payloads
- Remote file inclusion (RFI) attacks
- Other OWASP Top 10 threats
For a static Astro site, Shield is mostly defense against DDoS and bot traffic since there’s no server-side code to exploit. But it still reduces noise in your logs and can block scrapers or abuse patterns.
Enable Shield
- Go to Shield in the Bunny dashboard
- Create a new Shield Zone
- Connect it to your pull zone
- The free tier activates automatically
Optional: rate limiting and custom WAF rules
The paid tiers ($9.50/month for Advanced, $99/month for Business) add custom WAF rules, advanced bot detection, and rate limiting per IP or path. For a static blog, the free tier is usually enough. Rate limiting becomes relevant if you notice specific IPs hammering your site or if you want to block traffic from certain countries.
Set up Edge Rules for security headers
Edge Rules let you add custom headers to responses. Adding security headers is a quick win regardless of whether you use Shield:
- Go to Pull Zones → your pull zone → Edge Rules
- Create rules to add headers:
| Header | Value |
|---|---|
| Content-Security-Policy | default-src ‘self’; script-src ‘self’; style-src ‘self’ ‘unsafe-inline’; img-src ‘self’ data:; font-src ‘self’; frame-ancestors ‘self’ |
| X-Content-Type-Options | nosniff |
| X-Frame-Options | SAMEORIGIN |
| Referrer-Policy | strict-origin-when-cross-origin |
X-XSS-Protection is deprecated
Older guides recommend X-XSS-Protection: 1; mode=block. Don’t use it. Modern browsers have removed support and it can actually introduce XSS vulnerabilities in some edge cases. The Content-Security-Policy header above is the replacement. Also note that CSP frame-ancestors 'self' supersedes X-Frame-Options: SAMEORIGIN. Keep both since some older browsers still honor X-Frame-Options.
The CSP above is a reasonable starting point for a static Astro site. style-src 'unsafe-inline' is needed for Astro’s inline styles in some setups; tighten it in production if you can. Test with your browser’s console open. CSP violations show up there.
Bunny.net cost breakdown
What does this actually cost? Here’s a realistic scenario for a typical Astro blog:
| Resource | Monthly usage | Cost |
|---|---|---|
| Storage (Standard HDD, 1 region) | 500 MB | ~$0.01 |
| CDN bandwidth (EU/NA) | 25 GB | ~$0.25 |
| Storage → CDN traffic | - | $0.00 (free) |
| Shield (free tier) | - | $0.00 |
| Total | ~$0.26/month |
Under $4/year for a blog with moderate traffic, including DDoS protection and WAF. Even at 100 GB of monthly bandwidth you’re looking at roughly $1/month. For comparison, 25 GB on AWS CloudFront costs around $2.125 after the free tier, nearly 10x more for the same traffic.
Bunny has a $1 monthly minimum, but it’s account-wide: it covers your storage and CDN usage combined, not just bandwidth. For a small blog, that $1 is effectively your total bill.
Here’s the pricing breakdown for each piece (as of July 2026):
Storage pricing
- Standard (HDD): $0.01/GB per region for up to 2 regions, $0.005/GB for each additional region
- Edge (SSD): $0.02/GB per region (up to 15 regions total)
- 15 storage regions available, 99.99% availability SLA
- Free traffic to Bunny CDN when serving from Bunny Storage. No bandwidth charge for that hop
CDN bandwidth (Standard network, 119 PoPs)
- EU/NA: $0.01/GB
- Asia/Oceania: $0.03/GB
- South America: $0.045/GB
- Middle East & Africa: $0.06/GB
- Volume Network (10 PoPs): $0.005/GB first 500 TB, aimed at bandwidth-heavy sites
If you’re comparing storage options for your build artifacts or backups, I broke down Bunny Storage vs S3 vs Backblaze pricing in detail.
Overcharge Protection
Bunny offers bandwidth limits to prevent surprise bills. Set a monthly cap in your account settings and Bunny will alert you (or block traffic) before costs spiral. Worth doing on day one.
Troubleshooting
Site returns 404 errors
Check that your files are uploaded to the root of your storage zone, not inside a subfolder. The dist/ folder contents (not the folder itself) should be at the top level. With the deploy script, this is handled by the path stripping logic (remote_path="${file#$DIST_DIR/}"). If you uploaded manually, make sure you uploaded the contents of dist/, not the dist/ directory itself.
Also verify your pull zone is connected to the correct storage zone (Pull Zones → your zone → General → Origin Type should show “StorageZone” with the right zone selected).
CSS and JavaScript not loading
This is usually a MIME type issue. Bunny.net should detect and serve correct MIME types automatically, but if something is off:
- Check the pull zone’s Routing settings
- Make sure the Enable Static File Processing option is enabled if available
- Verify that your
dist/folder contains the referenced assets with correct file extensions
If you’re using Astro’s default build output, CSS and JS files are placed in dist/_astro/ with hashed filenames. As long as the full dist/ folder was uploaded, these should work.
Changes not visible after deployment
The CDN is serving cached content. Purge the cache:
- From the dashboard: Pull Zones → your zone → Purge Cache → Purge All Files
- The deploy script handles this automatically after each upload
Cache purges propagate within seconds on Bunny’s network. If you’re using Perma-Cache, note that a full pull zone purge doesn’t delete Perma-Cache files. It switches to a new directory structure instead.
Old files still served after deploy
The deploy script uploads files but doesn’t delete removed ones. If you deleted a blog post or renamed an asset, the old file is still in storage and may still be served.
To verify whether you’re seeing stale content:
curl -sI https://yourdomain.com/ | grep -i "age\|cache"After a fresh deploy and cache purge, you should see Age: 0 or a cache MISS on the first request. If you see Age values of hours or days, the purge didn’t fire.
Fixes: delete the storage zone contents before uploading, use the ayeressian/bunnycdn-storage-deploy action with remove: "true", or accept the staleness. Astro’s hash-fingerprinted assets (_astro/your-hash.css) won’t break when stale. Only old HTML pages linger.
SSL certificate not provisioning
SSL certificates are provisioned automatically when you add a custom hostname, but they require the DNS record to be pointing to Bunny first. Verify:
- Your CNAME or ANAME record is correctly configured at your DNS provider
- DNS has propagated (use
dig yourdomain.comto check) - Wait a few minutes after DNS propagation for the certificate to be issued
If it’s been over 30 minutes and the certificate is still pending, remove the hostname from Bunny and re-add it.
Deploy script fails with authentication errors
Double-check your credentials:
- Storage Password: This is the password from the storage zone’s FTP & API Access page, not your account password
- API Key: This is the key from Account Settings, not the storage password
- Pull Zone ID: This is a numeric ID, not the pull zone name. You can find it in the pull zone settings or the dashboard URL
Also make sure your .env file doesn’t have trailing whitespace or quotes around the values.
Deploy script fails with HTTP 401 or 403
A 401 or 403 from storage.bunnycdn.com means the storage password is wrong. A 401 from api.bunny.net means the account API key is wrong. Don’t mix them up. They’re different credentials:
- Storage uploads use the Storage Password as the
AccessKeyheader - CDN cache purge uses the Account API Key as the
AccessKeyheader
Common causes: copying the wrong value from the dashboard, trailing newline in .env, or a password that was regenerated (Bunny lets you reset the storage password, which invalidates the old one).
Frequently asked questions
Can I use this with other static site generators?
Yes. The same setup works with Hugo, Next.js (static export), Gatsby, 11ty, Jekyll, or any tool that outputs a folder of static files. The only Astro-specific step is the build command (npm run build producing a dist/ folder). Replace that with your generator’s build command and output directory, and everything else stays the same.
If you need a CMS for content management, here are the headless CMS options for Astro. Most of them output static files that deploy to Bunny the same way.
Why use the deploy script instead of Bunny Launcher?
Bunny Launcher is a third-party tool that abstracts away the Bunny API. The deploy script in this guide calls the Bunny Storage and CDN APIs directly with curl, so you can see exactly what’s happening and adapt it to any environment. It works in GitHub Actions, GitLab CI, or a local terminal without installing extra npm packages.
What about server-side rendering (SSR)?
This guide covers static sites only. Bunny.net’s edge storage and CDN serve pre-built files with no server-side runtime. If your Astro site uses SSR mode (output: 'server'), you need a hosting platform that runs Node.js. You can deploy Astro on a VPS with CloudPanel or deploy Astro on your VPS with EasyPanel. Both give you a Node.js runtime with a reverse proxy. You can still put Bunny CDN in front of your SSR server for caching, but that’s a different setup.
If you need a database for dynamic content, you can also pair your Astro site with Astro DB on Bunny Database, Bunny’s managed libSQL, so static pages come from the CDN while dynamic data lives in the same Bunny dashboard.
Do I need Bunny Optimizer?
Not necessarily. Astro handles image optimization, CSS minification, and JavaScript bundling during the build process. Your dist/ folder is already optimized. Bunny Optimizer is worth considering if you serve images that weren’t processed during build (user uploads, dynamically referenced assets) or want on-the-fly WebP/AVIF conversion. For a standard Astro blog, it’s redundant.
How do I handle redirects?
Use Bunny’s Edge Rules to set up redirects. Go to Pull Zones → your zone → Edge Rules and create a redirect rule. Common patterns include redirecting yourdomain.com to www.yourdomain.com, redirecting old URLs after a site migration, or enforcing trailing slash consistency.
For Astro’s built-in redirects (configured in astro.config.mjs), those generate a _redirects file in the dist/ folder during build. Bunny doesn’t process this file, so you’d need to replicate those rules as Edge Rules in the Bunny dashboard.
When should I outgrow static hosting?
When you need server-side logic: API routes, authentication, dynamic personalization. Bunny has options that keep you in the same dashboard:
- Edge Scripting: Deno-based edge functions ($0.2/million requests, $0.02/1000s CPU, $1/mo minimum). Good for SSR or API endpoints.
- Magic Containers: Docker containers at the edge ($0.005/GB/hr RAM, $2/mo IPv4). For containerized workloads.
- Bunny Database: Managed SQLite-compatible (libSQL) database for dynamic data. Pairs well with Astro DB on Bunny Database.
For most blogs and portfolio sites, static is the right call. Don’t add complexity you don’t need.
Can I use the official Bunny SDK instead of curl?
Yes. Bunny publishes @bunny.net/storage-sdk (v0.3.2 as of July 2026), a TypeScript SDK for programmatic storage operations: uploads, deletes, listing, with retries and typed responses. It’s a good fit for Node.js-based deploy scripts where you want to handle stale-file cleanup or parallel uploads.
For CLI-oriented operators, the bunny-tools npm package (v0.2.5) provides a CLI and MCP server for deploying to Bunny Storage and purging the CDN.
What should you know about wrapping up?
Your Astro site is now running on Bunny.net’s global CDN with edge storage, caching, and DDoS protection via Shield. Storage, CDN, SSL, WAF, and global delivery for under $1/month for most blogs.
Before you launch publicly, a few things worth doing:
- Add a contact form to your Astro site if you need one. Static sites don’t have backend forms, but there are free options
- Set up analytics (Plausible, Umami, or similar) so you know what’s working
- Back up your source repo. Your
dist/folder is just build output; the repo is the source of truth - Set bandwidth limits in Bunny to avoid surprise bills
If you run into issues, the troubleshooting section above covers the common ones. The GitHub Actions workflow from Step 3 is the logical next step if you want automatic deploys on every push to main.
Get Started with Bunny.netDid this guide work for you?
Need help with Astro, VPS, or a self-hosted app? View services →


