0

I'm attempting to make my MEAN stack web app work with Edge. The app works perfectly in Safari and Chrome. The issue is every time I log in (utilizing passport.js) as one user, the app shows data from the user previously logged in. If I refresh the page, the previous user's data is still there. After an extended period of time, the new user's data will appear.

Maybe a caching issue, as functionality becomes perfect once I open Dev Tools and click the "Always refresh from server" button on the toolbar. Too bad I can't ask every Edge customer to do this in order to use the app. How do I set this feature for the user, or stop this crazy caching, so functionality works in Edge?

I have tried to prevent all caching with express using this code:

res.header('Cache-Control', 'private, no-cache, no-store, must-revalidate');
res.header('Expires', '-1');
res.header('Pragma', 'no-cache');

However this method hasn't been working, and I wonder how it will affect performance on other browsers? I tried placing this on the user controller whenever a user object was retrieved or created, but the caching issue was still there. Please help!

Tori Huang
  • 507
  • 1
  • 4
  • 23
  • Could you put an example together and put it on jsfiddler or something? – user629283 Nov 04 '16 at 15:25
  • Hmm, I tried to do it but I'm not really sure how to replicate this issue in fiddle, as it seems to be across multiple files and maybe even related to different APIs like passport.js? My real question is, whatever clicking 'Always refresh from server' does in Edge developer tools, can I make that happen but through code? – Tori Huang Nov 04 '16 at 18:48
  • [This](http://stackoverflow.com/questions/3415370/ie-unable-to-download-from-unable-to-open-this-internet-site-the-request/19145399#19145399) and [this](http://stackoverflow.com/questions/49547/making-sure-a-web-page-is-not-cached-across-all-browsers) suggest that in previous Microsoft browsers `no-store` must be before `no-cache`. – Steven B. Nov 04 '16 at 22:47
  • Just using `res.header('Cache-Control', 'max-age=0');` is sufficient to always trigger a revalidation from Edge and other browsers. – DivineTraube Nov 05 '16 at 16:14

0 Answers0