1

I am using MEAN stack to develop my application. The application is working fine in chrome but when the page is opened in IE, and when user request for a page, I get 304 status from the server. Because of this cached page is served back to the user.

Interesting part is, if I open IE developer tool bar & then select network tab and record various request, the app starts to work fine. I start to get 200 response from server.

So far I have tried this: app.disable('etag');

and this :

app.get('/*', function(req, res, next){ 
  res.setHeader('Last-Modified', (new Date()).toUTCString());
  next(); 
});

But both the options did not work for me.

SharpCoder
  • 15,708
  • 34
  • 126
  • 225
  • http://stackoverflow.com/questions/49547/making-sure-a-web-page-is-not-cached-across-all-browsers – lv0gun9 Aug 20 '15 at 04:24

2 Answers2

0

Have you tried setting the cache headers described here: https://stackoverflow.com/a/9886945/442472.

Expires: Tue, 03 Jul 2001 06:00:00 GMT
Last-Modified: {now} GMT
Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate

I think that etag on its own doesn't allow browsers to understand what the server side desired caching strategy should be. etags are really just a way to identify a server side resource via a checksum.

Community
  • 1
  • 1
Shan Plourde
  • 8,128
  • 2
  • 25
  • 40
0

To answer my own question, this is what i added on the client side (Angular Side). I am basically adding date time as a query string paramter to every out going AJAX request.

$httpProvider.interceptors.push(function ($q) {
    return {
      'request': function (config) {
        config.url = config.url + '?token=' + new Date().toLocaleString() ;
        return config;
      }
    }
  });
SharpCoder
  • 15,708
  • 34
  • 126
  • 225