🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

SVGs Are Not Caching When Serving Over CDN

1 replies
Last updated: Jun 18, 2021
Hi all! We’re having some issues with SVGs uploaded to the image library are not cached when served over the CDN. The response is not returning a
header that lets the browser cache the file. PNGs get the correct
Cache-Control: public, max-age=31536000, s-maxage=2592000
header, but SVGs get no such thing.
According to the documentation the CDN used by Sanity is Google CDN. The Google CDN Caching Overview page (
https://cloud.google.com/cdn/docs/caching ) states that, among other MIME types, “Any 
” will be cached. The SVGs does indeed have
Content-Type: image/svg+xml
when returned from the CDN, so they seem like highly likely candidates for a proper
Is this a known issue? Something implemented specifically by Sanity for security reasons or other? Or just an unintended side effect? And have anyone bumped into this issue and solved it somehow? Any pointers and suggestions are welcome here.
Jun 18, 2021, 8:47 AM
Good catch! This is a bug.Will be fixed in a pending release, thanks for reporting!
Jun 18, 2021, 12:35 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?