Adding CDN in front of images prismic

Hey,

We are getting a bit overpowered by pricing. CDN and API calls.

Seems that vast majority of our calls to api are actually images.

There seems to be a pretty easy solution to that. To add proxy CDN with caching infront of images.prismic.io and rewrite all our links to that.

However, we might end up basically crashing whole site when some ddos protections will kick in.

Is there any way to whitelist certain IPs?

Also, I am probably gonna use bunny cdn. They provide ip lists:

https://bunnycdn.com/api/system/edgeserverlist

https://bunnycdn.com/api/system/edgeserverlist/IPv6

Would it be possible to use those lists automatically ( as in, i wouldn’t have to update you? )

1 Like

Hey @maciekpaprocki,

You can put Bunny in front of images.prismic.io to cache images and reduce origin hits, but it’s not our default recommendation. Prismic already uses imgix’s CDN with dynamic optimization (WebP/AVIF, quality, sizing). Adding another CDN can break format negotiation or sizing, and we can only provide limited support outside of our recommended setup. Also note we can’t whitelist Bunny IPs on the Prismic side; those IP lists are for your own firewall rules and they change regularly.

If you need to optimize your CDN/API calls and you haven’t had a look at our troubleshooting guide on the matter, give it a read: Optimizing Prismic API Usage: Why It Might Be Higher Than Expected . It might offer more options and other things to try first.

Let me know if there’s anything else we can do to help!

Hey,

Thanks for quick reply.

I agree, it’s not the best set up. Said that, we have around 12 to 1 image to content api requests and i cannot really optimise the image api requests. Seems like each image view counts as one api request. At least that’s what i can figure out from the dashboard.

When it comes to whitelisting ips from bunny. That’s ok, but can you at least tell me if that’s not gonna trigger your own firewall rules? It might be seen as a DDOS otherwise and my site might stop working correctly.

Hey @maciekpaprocki,

We don’t think it should be an issue, so you could give it a go, but take that with a grain of salt as some of it might depend on Imgix’s configurations as well. On our end it’ll be fine, and if anything happens, you can always link this forum thread in any ticket you raise and we’ll know exactly what to look into :slight_smile: