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

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -