node.js - Node, different cache rules for a particular file type -
i disabling cache app so:
app.use(function nocache(req, res, next) { res.header('cache-control', 'no-cache, no-store, must-revalidate'); res.header('pragma', 'no-cache'); res.header('expires', 0); next(); });
there problem using on https when using ie: https://connect.microsoft.com/ie/feedbackdetail/view/992569/font-face-not-working-with-internet-explorer-and-http-header-pragma-no-cache
how can change above code make not apply font type files? think solve issue.
thanks
you can check req.path
against extensions web fonts (ttf, woff, eot, etc), , skip sending headers in case:
const webfont_extensions = /\.(?:eot|ttf|woff|svg)$/i; app.use(function nocache(req, res, next) { if (! webfont_extensions.test(req.path)) { res.header('cache-control', 'no-cache, no-store, must-revalidate'); res.header('pragma', 'no-cache'); res.header('expires', 0); } next(); });
Comments
Post a Comment