Bubble automatically serves uploaded files through AWS CloudFront CDN, but large media apps benefit from additional CDN configuration. This tutorial covers how Bubble handles media distribution, how to use external CDNs like Cloudflare for video and large files, manage cache headers, and monitor CDN performance for faster load times.
Overview: CDN and Media Distribution in Bubble Apps
This tutorial explains how content delivery networks work with Bubble apps and how to optimize media distribution. Bubble uses AWS infrastructure with CloudFront CDN for file storage, but apps with heavy media (videos, large images, downloadable files) can benefit from additional CDN configuration. You will learn about Bubble's default media handling, when to use external CDNs, how to optimize images, and how to troubleshoot slow media loading. Ideal for founders building media-rich Bubble applications.
Prerequisites
- A Bubble app with uploaded media files (images, videos, or documents)
- Basic understanding of how web pages load images and files
- A Cloudflare account (free tier works for basic CDN setup)
- Familiarity with Bubble's Settings tab for domain configuration
Step-by-step guide
Understand Bubble's default CDN and media hosting
Understand Bubble's default CDN and media hosting
Bubble stores all uploaded files (images, videos, documents) on Amazon S3 and serves them through AWS CloudFront CDN automatically. When a user uploads a file via the File Uploader element, Bubble generates a URL like https://dd7tel2830j4w.cloudfront.net/... This CDN delivers files from edge servers closest to the user, providing reasonable performance for most apps. You do not need to configure anything — this works out of the box. However, Bubble does not offer granular control over cache headers, image transformations, or CDN rules.
Pro tip: Bubble added automatic image compression in February 2026, reducing image sizes by approximately 60% — make sure your app is on the latest platform version.
Expected result: You understand that Bubble already uses CloudFront CDN for all uploaded files and can identify your file URLs.
Optimize image sizes before uploading
Optimize image sizes before uploading
Even with Bubble's CDN, large images slow down page loads. Before uploading, resize images to the maximum display size they will be shown at in your app. For hero images, 1920px wide is sufficient. For thumbnails, 400px wide works well. Use a free tool like TinyPNG, Squoosh, or ImageOptim to compress images before uploading. In Bubble, set Image elements to use the 'imgix' dynamic image resizing by appending width and quality parameters to image URLs using the :append operator (though this requires the image URL to support it).
Expected result: All images in your app are optimized for their display size, reducing page load times significantly.
Set up Cloudflare as an additional CDN layer
Set up Cloudflare as an additional CDN layer
If your app serves large media files (videos, downloads, or high-resolution images), Cloudflare's free plan adds an extra caching layer. Go to cloudflare.com and add your custom domain. Cloudflare will provide you with nameservers — update your domain registrar to use Cloudflare's nameservers. In Cloudflare's DNS settings, add a CNAME record pointing your domain to your Bubble app. Set the proxy status to DNS only (grey cloud) for the main domain to avoid SSL conflicts with Bubble. For a dedicated media subdomain (like media.yourdomain.com), you can enable Cloudflare's proxy (orange cloud) to cache files at the edge.
Pro tip: Use DNS only mode for your main Bubble domain to prevent SSL conflicts, but enable the Cloudflare proxy on a media subdomain for CDN benefits.
Expected result: Your domain is set up through Cloudflare with DNS configured correctly for your Bubble app.
Use external video hosting for large video files
Use external video hosting for large video files
Storing videos directly in Bubble is inefficient — they consume storage space and do not benefit from video-specific optimizations like adaptive bitrate streaming. Instead, upload videos to a dedicated video platform like YouTube (free), Vimeo (paid, cleaner embeds), or Mux (developer-focused). Then embed the video in your Bubble app using an HTML element with an iframe tag, or a Video element if the platform provides direct video URLs. Store the embed URL or video ID in your database rather than the video file itself.
Expected result: Videos play through dedicated video CDNs with adaptive streaming, instead of loading from Bubble's file storage.
Implement lazy loading for media-heavy pages
Implement lazy loading for media-heavy pages
For pages with many images (like galleries or product catalogs), enable lazy loading so images only load when the user scrolls to them. Bubble does not have a native lazy loading toggle, but you can achieve this by using a Repeating Group with a limited page size (10-20 items) and pagination or infinite scroll. The Repeating Group only renders visible cells, so images in later pages do not load until the user scrolls or clicks to the next page. For individual images outside Repeating Groups, use conditional visibility — set the Image to only be visible when a custom state indicates the section is in view.
Pro tip: Combine pagination with a 'Load more' button pattern — show 10 items initially with a button that loads the next 10, rather than loading all items at once.
Expected result: Media-heavy pages load quickly by only fetching images that are currently visible to the user.
Monitor media loading performance
Monitor media loading performance
Open your Bubble app in the browser and use the Developer Tools (right-click → Inspect → Network tab) to monitor how media files load. Filter by 'Img' to see all image requests. Check the Size column (smaller is better) and the Time column (under 200ms per image is ideal). Look for images that are larger than necessary or take too long to load. In your Bubble app, check the Logs tab to see workload unit consumption from file operations. Use Google PageSpeed Insights (pagespeed.web.dev) to get a score and specific recommendations for your app's media loading performance.
Expected result: You can identify slow-loading media files and take action to optimize them using compression, resizing, or CDN configuration.
Complete working example
1CDN AND MEDIA OPTIMIZATION SUMMARY2====================================34BUBBLE DEFAULT SETUP:5 Storage: Amazon S36 CDN: AWS CloudFront (automatic)7 URL pattern: https://dd7tel2830j4w.cloudfront.net/...8 Image compression: Automatic (~60% reduction, Feb 2026+)9 Control: None (no custom cache headers or rules)1011IMAGE OPTIMIZATION CHECKLIST:12 □ Resize before upload:13 Hero images: max 1920px wide14 Card images: max 800px wide15 Thumbnails: max 400px wide16 Avatars: max 200px wide17 □ Compress with TinyPNG/Squoosh/ImageOptim18 □ Use WebP format when possible19 □ Target: under 200KB per image2021EXTERNAL CDN (CLOUDFLARE) SETUP:22 1. Add domain to Cloudflare (free plan)23 2. Update nameservers at domain registrar24 3. DNS records:25 Main domain → CNAME → Bubble app (DNS only / grey cloud)26 media.domain.com → CNAME → Bubble app (Proxied / orange cloud)27 4. SSL mode: Full (not Full Strict)28 5. Cache rules: default (respects origin headers)2930VIDEO HOSTING STRATEGY:31 DO NOT: Upload videos to Bubble file storage32 DO: Use external video platforms:33 YouTube (free, ads on free tier)34 Vimeo (from $12/mo, clean embeds)35 Mux (developer API, adaptive streaming)36 EMBED: HTML element with iframe OR Video element37 STORE: Video URL/ID in database, not the file3839LAZY LOADING PATTERN:40 Repeating Groups:41 Set page size to 10-20 items42 Add 'Load more' button or pagination43 RG only renders visible cells44 Individual images:45 Conditional visibility based on scroll position46 Custom state: is_section_visible (yes/no)4748PERFORMANCE MONITORING:49 Browser DevTools → Network → Img filter50 Target per image: <200KB size, <200ms load51 Google PageSpeed Insights: pagespeed.web.dev52 Bubble Logs tab: check file operation WU costsCommon mistakes when managing content delivery networks (CDNs) for media distribution in Bubble.
Why it's a problem: Uploading full-resolution photos directly from a phone camera
How to avoid: Resize and compress all images before uploading — use TinyPNG or Squoosh to get images under 200KB while maintaining visual quality
Why it's a problem: Hosting videos in Bubble's file storage
How to avoid: Upload videos to YouTube, Vimeo, or Mux and embed them in your Bubble app using an HTML element or Video element
Why it's a problem: Enabling Cloudflare proxy mode on the main Bubble domain
How to avoid: Use DNS only mode (grey cloud) for your main Bubble domain and only enable proxy on a separate media subdomain
Best practices
- Compress and resize all images before uploading to Bubble — target under 200KB per image
- Use external video platforms like YouTube or Vimeo instead of storing videos in Bubble
- Implement pagination or load-more patterns for pages with many images
- Use DNS only mode for Cloudflare on your main Bubble domain to avoid SSL conflicts
- Check Google PageSpeed Insights regularly and address image-related recommendations
- Store image dimensions in your database to set element sizes and prevent layout shifts during loading
- Use WebP image format when possible for 25-35% smaller file sizes compared to JPEG
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
My Bubble app has a product catalog with 500+ images and the pages load slowly. Can you help me create an optimization plan covering image compression, lazy loading, and CDN configuration?
Help me optimize media loading in my app. I have a product catalog with hundreds of images loading slowly. Set up image optimization, implement pagination in my Repeating Group, and configure proper image sizing.
Frequently asked questions
Does Bubble use a CDN for file delivery?
Yes. Bubble automatically serves all uploaded files through AWS CloudFront CDN. Files are cached at edge servers worldwide for faster delivery. You do not need to configure this — it works by default.
Can I use my own CDN with Bubble?
You can add Cloudflare as an additional CDN layer for your custom domain, but you cannot replace Bubble's built-in CloudFront CDN for files stored in Bubble. For maximum CDN control, host large media files externally.
How do I reduce image loading times in my Bubble app?
Compress images before uploading (use TinyPNG), resize to the maximum display dimensions needed, use Repeating Group pagination to limit simultaneously loaded images, and leverage Bubble's automatic image compression feature.
Should I store videos in Bubble?
No. Store videos on dedicated platforms like YouTube, Vimeo, or Mux that provide adaptive bitrate streaming and video-specific CDN optimization. Embed the video player in your Bubble app and store only the video URL in your database.
Will Cloudflare conflict with Bubble's SSL?
It can. Use DNS only mode (grey cloud icon) for your main Bubble domain CNAME record in Cloudflare. Only enable the Cloudflare proxy on separate subdomains not directly serving the Bubble app.
Can RapidDev help optimize my Bubble app's media performance?
Yes. RapidDev can audit your app's media loading performance, implement image optimization workflows, configure external CDN layers, and set up video hosting integrations to dramatically improve your page load times.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation