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
cache-control
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
Content-Type
matching
image/*
” 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
Cache-Control
header.
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.
🙏