/**
 * connect-cache-control
 *
 * Connect middleware to prevent the browser
 * from caching the response.
 *
 * Copyright (c) Eric Elliott 2013
 *
 * MIT License
 *
 * Written for the book, 
 * "Programming JavaScript Applications"
 * (O'Reilly)
 */

'use strict';

var cacheControl = function cacheControl(req, res,
    next) {

  // Support old browsers
  res.setHeader('Expires', 0);

  // Support recent browsers
  res.setHeader('Cache-Control', 'no-store, ' +
    'no-cache, must-revalidate, max-age=0');

  // This isn't a standard response header,
  // but many browsers respect it.
  res.setHeader('Pragma', 'no-cache');

  next();
};

module.exports = cacheControl;

/**
 * connect-cache-control
 *
 * Connect middleware to prevent the browser
 * from caching the response.
 *
 * Copyright (c) Eric Elliott 2013
 *
 * MIT License
 *
 * Written for the book, 
 * "Programming JavaScript Applications"
 * (O'Reilly)
 */

'use strict';

var cacheControl = function cacheControl(req, res,
    next) {

  // Support old browsers
  res.setHeader('Expires', 'Fri, 01 Jan 1990 00:00:00 GMT');

  // Support recent browsers
  res.setHeader('Cache-Control', 'no-store, ' +
    'no-cache, must-revalidate, max-age=0');

  // This isn't a standard response header,
  // but many browsers respect it.
  res.setHeader('Pragma', 'no-cache');

  next();
};

module.exports = cacheControl;


Set response header to a valid date in the past.
Set response header to a valid date in the past.

Change the response header from 'Expires=0' to 'Expires=Fri, 01 Jan 1990 00:00:00 GMT'

From: https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching_FAQ

"It is interesting to note that "Expires: 0" and "Pragma: no-cache" are technically invalid response headers. If none of these headers are present, then the expiration calculation is essentially the algorithm described in RFC 2616 section 13.2."