Serving Static Files with Cache-Control Header in Glitch

How can I serve static files (images) with Cache-Control header in Glitch? When I upload a png file in my public folder, it automatically moves it to assets.

All I want is that if I go to mywebsite.com/images/someimage.png then the image is served with cache headers.

app.use(‘/images’, express.static(‘public’), {
setHeaders: (res, filePath) => {
res.set(‘Cache-Control’, ‘public, max-age=31536000, immutable’); // Cache for 1 year
}
});

The best way to do that is to put your images in your static asset folder, and serve those, as all of those will be backed by CDN and served as close to the user as possible, without ever needing to ask your server for them.

So instead of linking to some relative image, you just copy the asset URL and drop that in the src attribute.

app.use(..., express.static(‘public’), {

I think you put an extra ) between 'public' and your express.static options object

usual advice there is to wget it from the glitch project terminal