title: Browser cache: Json response
body: <p>i tried to cache a json response from an api request using the Etag.
  I'm calling something like this <a href="http://localhost:3000/api/config" rel="nofollow">http://localhost:3000/api/config</a> and getting:</p>
  
  <p><strong>Response Headers:</strong><br />
  Cache-Control:public, max-age=31557600<br />
  Connection:keep-alive<br />
  Content-Length:11<br />
  Content-Type:application/json; charset=utf-8<br />
  Date:Wed, 13 May 2015 11:41:52 GMT<br />
  ETag:"94d52736bcd99b1ac771f13b1bbdf622"<br />
  X-Powered-By:Express<br /></p>
  
  <p>Resonse: {id: 1}<br /></p>
  
  <p>I expected the browser to cache the response and to send the Etag with the next request triggert by "f5". But this isn't the case.</p>
  
  <p><strong>Request Headers 2nd request:</strong><br/>
  Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,<em>/</em>;q=0.8<br />
  Accept-Encoding:gzip, deflate, sdch<br />
  Accept-Language:de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4<br />
  Cache-Control:no-cache<br />
  Connection:keep-alive<br />
  Host:localhost:3000<br />
  Pragma:no-cache<br />
  User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36<br /></p>
  
  <p>So is it impossible to cache pure json response, getting by a direct api requests?<br /> Or do i miss something.</p>
  
  <p>The api is an node js test implemantation done with express:</p>
  
  <pre><code>router.get('/config', function(req, res) {
      var eTag = crypto.createHash('md5').update(JSON.stringify(config)).digest('hex');
      res.setHeader('ETag', '"' + eTag + '"');
      res.setHeader('Content-Type', 'application/json');
      res.setHeader('Cache-Control', 'public, max-age=31557600');
  });
  </code></pre>
  
  <p>Testet with chrom(42.x) and firefox(37.x)</p>
  
  <p>Thx for response.</p>