Prismic bandwidth limit reached? How to cut your CDN usage
Got the 80% email from Prismic? Here’s how to find out which files are eating your CDN bandwidth, and what to change so it doesn’t happen again next month.
Prismic emails you at 80%, 90% and 100% of your CDN bandwidth, and if you keep going it upgrades your plan for you. We’ve had that email on a few client sites at Undefined, and every time it came down to a couple of files, not the site as a whole.
This is how we track them down and fix it.
What counts as bandwidth
Everything Prismic’s CDN sends out: images, files like PDFs and video, and the JSON your site gets back from the API. Cached API responses still count, because the data still gets sent. This staff FAQ explains it well.
At the time of writing, the plans include:
- Free, Starter and Small: 100GB
- Medium: 500GB
- Platinum: 1TB
Over that, paid plans pay per GB (currently $0.30, or $0.25 on Platinum) up to a hard limit, and then Prismic moves you up a plan automatically. A free repository gets locked instead.
Find what’s using it
Start with Settings → Usage Dashboard in your repository. It shows API calls and CDN bandwidth for the current cycle, and you can download a CSV with a source and referrer per entry. The data can be up to 24 hours behind.
What it doesn’t show is bandwidth per file, and that’s what you actually need. The trick most people don’t know: ask Prismic support. Send them your repository URL and when the spike happened, and they can send you a summary of the most used media files. In one case they shared, a single video was 85% of a spike.
While you wait for them to get back to you:
- Spikes on one or two days: often a crawler. In one thread it turned out to be Googlebot.
- Steady growth: usually images served too big, or a video that lives in the media library.
- Lots of API calls: your site fetches content in the browser on every visit.
Fix it, biggest wins first
- 1
Move video to Bunny, keep a URL in Prismic
Prismic’s own docs say video can use up your bandwidth quickly. A single background video can easily be more than the rest of the site together.
What we do on client sites at Undefined: the video goes on Bunny, and the slice gets a URL field instead of a media link.
- Short muted loops (hero backgrounds, product clips): upload the mp4 to a Bunny storage zone with a pull zone in front. About $0.01/GB in Europe and North America.
- Longer videos with sound: Bunny Stream, which encodes a few qualities so phones don’t get the 1080p version.
- In Prismic: a Key Text field for the Bunny URL, plus an Image field for the poster, so the still frame still goes through imgix.
// slice model "video_url": { "type": "Text", "config": { "label": "Video URL (Bunny)" } }, "poster": { "type": "Image", "config": { "label": "Poster" } } // rendering it <video src={slice.primary.video_url ?? undefined} poster={asImageSrc(slice.primary.poster, { w: 1600 }) ?? undefined} autoPlay muted loop playsInline />Editors paste a link instead of uploading, and the video never touches your Prismic bandwidth. Same trick for big PDFs.
One gotcha: deleting a file from the media library doesn’t kill its URL, so old links keep working (and keep using bandwidth). Send support the URLs if you want them purged.
- 2
Ask for the size you need
Images come from imgix with auto=compress,format already on, so you get AVIF or WebP for free. Keep that. What it doesn’t do is resize, so if you render image.url as is, every visitor downloads the full upload.
With @prismicio/next, PrismicNextImage builds a srcset for you. Give it a proper sizes, so phones pick a small one:
<PrismicNextImage field={slice.primary.image} sizes="(min-width: 1024px) 50vw, 100vw" />Not on Next? PrismicImage from @prismicio/react does the same with widths, or add w to the URL yourself. Prismic counts the version that actually gets sent, so a resized image really is less bandwidth.
- 3
Stop fetching on every visit
Fetching content in the browser means an API call every time someone opens a page. Prismic staff wrote a good guide on this, the short version:
- Build pages statically (or with ISR) and rebuild on a publish webhook
- One query per page where you can, with pageSize up to 100 for lists
- Use fetchLinks or GraphQuery so you only get the fields you render
This helps both your API calls and the JSON part of your bandwidth.
- 4
A CDN in front? Think twice
You can put something like Bunny in front of images.prismic.io, but Prismic staff call it not their default recommendation, and it can break the format and size magic if you get the cache settings wrong. If you do try it, the size is in the query string (?w=800), so turn on Vary cache → URL query string, and vary on the Accept header or set fm=webp yourself.
Honestly, for most Prismic sites the Bunny win is video and PDFs (step 1), not images.
Checklist
See every image your content uses
Paste your URL. Cojack syncs your whole repository, so you can search every image and see which documents use it. Handy for tracking down that 12MB hero.
Questions you asked
QDo cached API responses count towards bandwidth?
Yes. The JSON still gets sent, so it counts. It’s usually small next to images though, unless you fetch a lot of documents on every page view.
QCan I see bandwidth per file myself?
Not in the dashboard at the time of writing. Ask support for a summary of the most used media files, with your repository URL and the date of the spike.
QWill Prismic upgrade my plan without asking?
Yes, by default, once you hit the hard limit. You get emails at 80%, 90% and 100% first. You can switch the automatic upgrade off in the Spend Manager, but then the repository pauses instead.
QShould I compress images before uploading?
No need, Prismic’s docs advise against it. imgix compresses on the way out. Do keep uploads sensible though, a 6000px photo is never going to be needed.
