Question

I've read in a few answers here on StackOverflow that it's better to use the iisnode's static files configurations rather than let node.js handle it.

That's ok, but I just can't find a way to get it to work with the traditional configurarion for browse caching:

<staticContent>
    <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
</staticContent>

When I'm using the node'js normal browse cache, that's how it's configured (and working):

app.use(express.static(path.join(__dirname, 'public'), {maxAge: 86400000}));

My questions, than, are:

  • Is it really better to use the iisnode static files serving system?
  • Is there a way to make <clientCache ... to work in IISnode?

Thanks

Was it helpful?

Solution

I basically gave up trying to use IIS to serve static files and started using the maxAge option of the default Express static middleware, but I quickly grew tired trying to setup Grunt workflows to make sure the names of my static files change when the contents change.

Ended up writing a bit of Node.js middleware called Electricity which I tried to make as a mostly drop in replacement to the default Express static middleware: https://github.com/mediocre/electricity

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top