no cache for xmlHttpRequest
Showing
1 changed file
with
8 additions
and
0 deletions
@@ -102,6 +102,14 @@ try { | @@ -102,6 +102,14 @@ try { | ||
102 | app.use(devtools()); | 102 | app.use(devtools()); |
103 | } | 103 | } |
104 | 104 | ||
105 | + // set no cache | ||
106 | + app.use((req, res, next) => { | ||
107 | + if (req.get('X-Requested-With') === 'XMLHttpRequest') { | ||
108 | + res.set('Cache-Control', 'no-cache'); | ||
109 | + } | ||
110 | + next(); | ||
111 | + }); | ||
112 | + | ||
105 | require('./dispatch')(app); | 113 | require('./dispatch')(app); |
106 | 114 | ||
107 | app.all('*', errorHanlder.notFound()); // 404 | 115 | app.all('*', errorHanlder.notFound()); // 404 |
-
Please register or login to post a comment