title: Express: SetHeader 'Cache-Control' for a single file after setting maxAge
body: <p>node newbie here. The below code results in all files receiving the response header "Cache-Control public, max-age=31536000". I would like the index to have a max-age of 0. I have tried several different methods but the root of it seems to be a more fundamental misunderstanding on my part.</p>
  
  <p>Why does the below res.setHeader line not take effect (so that I can understand my misconception) and what would be the correct method to ensure Index.html is not cached?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var express    = require('express'),
      gzipStatic = require('connect-gzip-static'),
      app        = express(),
     
      port= process.env.PORT || 3030,
      cacheAge = 365 * 24 * 60 * 60 * 1000;
  
  app.use(gzipStatic(__dirname + '/public', { maxAge: cacheAge }));
  
  app.get('/', function(req, res) {
      res.setHeader('Cache-Control', 'max-age=0');
      res.sendFile('index.html');
  });</code></pre>
  </div>
  </div>
  </p>