I have an express web server that servers super-dynamic images.
The images then go on to be hosted on other websites, which use cloudflare.
On my site, the images are dynamic, like I want, and reload every single time the page loads.
Here are the routes:
app.get("/comments/:id.:ext",(req, res, next) => {
res.setHeader('Cache-Control', 'no-store');
res.setHeader('Surrogate-Control', 'no-store');
res.setHeader('Pragma', 'no-cache');
res.setHeader('Expires', '0');
next();
}, imageRoute);
app.get("/comments/:id", (req, res, next) => {
res.setHeader('Cache-Control', 'no-store');
res.setHeader('Surrogate-Control', 'no-store');
res.setHeader('Pragma', 'no-cache');
res.setHeader('Expires', '0');
next();
}, imageRoute);
Cloudflare docs says
Cloudflare does not cache the resource when:
The Cache-Control header is set to private, no-store, no-cache, or max-age=0.
The Set-Cookie header exists.
But, on the host website (replit.com, for reference), the images take hours to update.
They seem to be hosted on a CDN...
Here is a link to an example image: https://replit.com/cdn-cgi/image/quality=80,metadata=copyright,format=auto/https://image-comments.sojs.dev/comments/14.png
The original url is https://image-comments.sojs.dev/comments/14.png.
That URL is never cached.
For reference:
I do not understand why my headers are being ignored.
Any help appreciated

