Closed raindecastro closed 4 years ago
Was able to fix it up when I reconfigured my express app
@raindecastro Hi! I'm also seeing Cache-Control: public, max-age=0
for requests like /_next/static/images/blah-abc123...jpg
. Can you say what you did in the express server to configure the cache-control header for images?
@aimichal For sure! here's the code snippet, it's just pretty much getting the path of the image files and setting their headers.
const server = express();
server.get(/^\/_next\/static\/(images|fonts)\//, (_, res, nextHandler) => {
res.setHeader('Cache-Control', 'public, max-age=31536000, immutable');
nextHandler();
});
My main image keeps on fetching and I want to be able to cache it.
This is the header that i'm getting in dev tools - Cache-Control: public, max-age=0
Is there a way for me to chance the max-age?