Get a peek at our latest innovations at Sanity Product Day on Dec 8th →

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 ( ) 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 Get the most out of your content is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Free to get started, and pay-as-you-go on all plans. Find out more.