title: How to make browser cache assets with express.js
body: <p>I want my assets to be cached by browser. So I use:</p>
  
  <pre><code>var oneDay = 86400000;
  app.use(express.static('public', { maxAge: oneDay }));
  </code></pre>
  
  <p>So in response I see:</p>
  
  <pre><code>cache-control: public, max-age=86400000
  </code></pre>
  
  <p>But when assets are requested by browser it still makes request to server and usually gets 304 not modified response and only then takes version from cache.</p>
  
  <p><strong>In response I also see 'Etag' and 'Last-Modified' headers, maybe they for such behaviour? (any why I wasn't able to get read of Last-Modified header to check it.</strong></p>
  
  <p>If I understand correctly I max-age was set in response when downloading resource for the first time, then browser while the period (set by max-age) should take if from cache and not make any request to server.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>I wonder how people serve static assets and index files in production with express.js?</p>