Authored by 徐炜

错误页面不缓存

... ... @@ -9,6 +9,12 @@ exports.notFound = () => {
return (req, res) => {
res.status(404);
res.set({
'Cache-Control': 'no-cache',
Pragma: 'no-cache',
Expires: (new Date(1900, 0, 1, 0, 0, 0, 0)).toUTCString()
});
if (req.xhr) {
return res.json({
code: 404,
... ... @@ -34,6 +40,12 @@ exports.notFound = () => {
*/
exports.serverError = () => {
return (err, req, res, next) => {
res.set({
'Cache-Control': 'no-cache',
Pragma: 'no-cache',
Expires: (new Date(1900, 0, 1, 0, 0, 0, 0)).toUTCString()
});
logger.error(`error at path: ${req.url}`);
logger.error(err);
... ...