svimg
svimg copied to clipboard
Add cache control header
For images imported using Vite, SvelteKit serves them with the same far future cache header that it uses for JS and CSS assets, allowing the image to be cached by browsers and CDNs for 1yr. Example:
File: /_app/immutable/assets/logo.51dc829a.svg
Header: Cache-Control: public,max-age=31536000,immutable
However, images generated using svgimg
do not have a cache control header when served :
// No cache control header.
File: static/images/g/screenshot.ad63d76.2defc3d93c320814083cab981b15c337.avif
I would like to see this work aswell, have you found any workarounds?
@ErikSandquist SvelteKit now has built in image support. Better to transition over to that, imo. It builds the images Vite and adds hashes to the file names, so you can cache them well.
@jasongitmail Thanks for the info. Will check it out!