Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
通过 Node.js 发送图像时,告诉浏览器永久缓存图像所需的 http 标头是什么?
开始了:
if (!res.getHeader('Cache-Control') || !res.getHeader('Expires')) { res.setHeader("Cache-Control", "public, max-age=345600"); // ex. 4 days in seconds. res.setHeader("Expires", new Date(Date.now() + 345600000).toUTCString()); // in ms. }