title: The response.setheader on a java servlet does not disable browser cache
body: <p><em>What I am trying to do</em> </p>
  
  <p>Goal
   1.  Not allow the browser to cache responses from the server
   2. After session logout the back button should not bring the user to a cached page</p>
  
  <p><em>What I have done so far</em></p>
  
  <p>In my web app, i have a login page that authenticates a user and then routes to another page via the Login servlet. In the Login servlet I have set the response header to not cache the html pages. This does not work.</p>
  
  <p>Currently I  use the below in the doPost method of the Login servlet </p>
  
  <pre><code>response.setHeader("Cache-control","no-cache, no-store, must-revalidate");
  response.setHeader("Pragma","no-cache");
  response.setHeader("max-age", "-1");
  response.setDateHeader("Expires", 0);
  </code></pre>
  
  <p><em>Results</em>
  The html page header (from google chrome dev tools ) shows this</p>
  
  <blockquote>
    <p>Accept-Ranges:bytes Content-Length:8404 Content-Type:text/html
    Date:Sat, 16 Jan 2016 22:26:57 GMT ETag:W/"8404-1452983191066"
    Last-Modified:Sat, 16 Jan 2016 22:26:31 GMT Server:Apache-Coyote/1.1</p>
  </blockquote>
  
  <p>Any suggestions people.. Thanks in advance for you time?</p>