Authored by 徐炜

错误页面不缓存

@@ -9,6 +9,12 @@ exports.notFound = () => { @@ -9,6 +9,12 @@ exports.notFound = () => {
9 return (req, res) => { 9 return (req, res) => {
10 res.status(404); 10 res.status(404);
11 11
  12 + res.set({
  13 + 'Cache-Control': 'no-cache',
  14 + Pragma: 'no-cache',
  15 + Expires: (new Date(1900, 0, 1, 0, 0, 0, 0)).toUTCString()
  16 + });
  17 +
12 if (req.xhr) { 18 if (req.xhr) {
13 return res.json({ 19 return res.json({
14 code: 404, 20 code: 404,
@@ -34,6 +40,12 @@ exports.notFound = () => { @@ -34,6 +40,12 @@ exports.notFound = () => {
34 */ 40 */
35 exports.serverError = () => { 41 exports.serverError = () => {
36 return (err, req, res, next) => { 42 return (err, req, res, next) => {
  43 + res.set({
  44 + 'Cache-Control': 'no-cache',
  45 + Pragma: 'no-cache',
  46 + Expires: (new Date(1900, 0, 1, 0, 0, 0, 0)).toUTCString()
  47 + });
  48 +
37 logger.error(`error at path: ${req.url}`); 49 logger.error(`error at path: ${req.url}`);
38 logger.error(err); 50 logger.error(err);
39 51