title: Headers not setting with redirect using node.js / Express
body: <p>I am relatively new to node.js, Express, and mobile development, and have run into a problem that I think has to do with sending headers with Express.  </p>
  
  <p>The user starts at the home page '/', not logged in, then clicks a button to go to the sign-in page.  When they submit their username and password to '/validate_signin', they should be redirected back to the home page, this time with the home page showing up differently because they are logged in.</p>
  
  <p>The redirection worked like this:</p>
  
  <pre><code>res.redirect('/');
  </code></pre>
  
  <p>This works fine on my laptop, but on my mobile phone it redirects to '/', in its old state, presumably because of caching. If I refresh the page on the phone, '/' will show up as it should.</p>
  
  <p>I found this post:
  <a href="https://stackoverflow.com/questions/49547/making-sure-a-web-page-is-not-cached-across-all-browsers">How to control web page caching, across all browsers?</a></p>
  
  <p>Have tried to set headers in the following two ways (separately), but they don't seem to be sending:</p>
  
  <pre><code>res.header("Cache-Control", "no-cache, no-store, must-revalidate");
  res.header("Pragma", "no-cache");
  res.header("Expires", 0);
  
  res.writeHead(302, {
      "location": "/",
      "Cache-Control" : "no-cache, no-store, must-revalidate",
      "Pragma": "no-cache",
      "Expires": 0
  });
  </code></pre>
  
  <p>Here are the headers that I am currently receiving:</p>
  
  <pre><code>HTTP/1.1 304 Not Modified
  X-Powered-By: Express
  Date: Fri, 13 Jul 2012 17:35:18 GMT
  Cache-Control: public, max-age=0
  Last-Modified: Fri, 13 Jul 2012 12:32:12 GMT
  Etag: "3223-1342182732000"
  Accept-Ranges: bytes
  Connection: keep-alive
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Many thanks.</p>