How It Works
Bunny Storage combined with a Pull Zone provides a simple, fast way to host static frontends:- Build your application locally
- Upload the build output to a Storage Zone
- Connect a Pull Zone for global CDN delivery
- Configure edge rules for SPA routing (if needed)
Single-Page Application Routing
Single-page applications (React, Vue, Angular, etc.) handle routing client-side. When a user navigates directly to a route like/dashboard or refreshes the page, the CDN needs to serve index.html instead of returning a 404.
Why SPAs need special configuration
Why SPAs need special configuration
When your SPA loads, the JavaScript router takes over navigation. But if a
user: - Bookmarks a deep link like
/products/123 - Refreshes the page on
/settings - Shares a URL like /about The browser requests that exact path
from the server. Since no file exists at that path (only index.html and your
assets exist), the server returns a 404. The solution is to configure an Edge
Rule that serves index.html for all non-asset requests, allowing your
client-side router to handle the URL.Configure SPA Fallback
To enable client-side routing, create an Edge Rule in your Pull Zone:1
Open Edge Rules
Go to CDN → select your Pull Zone → Edge Rules → Add Edge Rule
2
Set the condition
Add a condition: If URL does not match with the regex pattern: ```
.(js|css|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf|eot|json|webp|avif|mp4|webm)$
matches all static asset extensions that should be served directly.
3
Save the rule
Click Save to activate the rule.
index.html, and your client-side router will handle the path.
Framework Guides
Vite
Deploy a Vite-built static site with optimal configuration.
React
Deploy Create React App and other React builds.
Vue
Deploy Vue CLI and Vite-based Vue applications.
Common Configuration
Custom Domains
Add your own domain to any frontend deployment:- In your Pull Zone, go to Hostnames
- Click Add Hostname and enter your domain
- Add a CNAME record pointing to
your-pullzone.b-cdn.net - Enable Free SSL for automatic HTTPS
Cache Configuration
Static frontends benefit from aggressive caching. Consider these settings in your Pull Zone:| File Type | Recommended Cache Time |
|---|---|
| HTML | Short (1 hour) or use cache busting |
| JS/CSS (hashed) | Long (1 year) |
| Images | Long (1 month+) |
| Fonts | Long (1 year) |
Modern build tools like Vite add content hashes to filenames (e.g.,
main.a1b2c3.js), making it safe to cache these files indefinitely.