jaaja321
(Jaaja321)
1
I already have preoptimized images in my remote storage and i want them to be cached in Vercel’s CDN
<Image unoptimized={true}/>
isn’t uploading image to CDN
Headers for image didn’t work either
'Cache-Control': 'public, max-age=3600',
'CDN-Cache-Control': 'max-age=60',
'Vercel-CDN-Cache-Control': 'max-age=3600'
And in Vercel’s API it seems to be nothing
If anyone knows how to do it,please help
swarnava
(Swarnava Sengupta)
4
You can either use unoptimized
prop individually:
import Image from 'next/image'
const UnoptimizedImage = (props) => {
// Default is false
return <Image {...props} unoptimized />
}
or set the value globally for all images in next.config.js
module.exports = {
images: {
unoptimized: true,
},
}
jaaja321
(Jaaja321)
5
i even just tried this,guessing that maybe answer is not like “no” but seems like it because this part of docs is saying
true
: The source image will be served as-is from the src
instead of changing quality, size, or format.
swarnava
(Swarnava Sengupta)
6
You need to also purge CDN cache to invalidate old images: Manually purge the CDN cache - Vercel