From 1ac57d2081cf05b82ad0e9982e4b3a013f43a961 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 4 Aug 2020 20:34:09 -0700 Subject: don't cache error responses --- index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index bd09ae1b..cad45728 100644 --- a/index.js +++ b/index.js @@ -11,7 +11,9 @@ l = require("pino")(); config = require("./config"); networks = []; prod = process.env.NODE_ENV === "production"; -fail = (msg) => { throw new Error(msg) }; +fail = (msg) => { + throw new Error(msg); +}; challenge = {}; logins = {}; @@ -23,7 +25,7 @@ if (config.liquid) networks.push("liquid"); if (config.lna) networks.push("lightning"); SATS = 100000000; -toSats = n => parseInt((n * SATS).toFixed()); +toSats = (n) => parseInt((n * SATS).toFixed()); app = express(); app.enable("trust proxy"); @@ -60,13 +62,16 @@ app.use((err, req, res, next) => { path: req.path, body: req.body, msg: err.message, - stack: err.stack + stack: err.stack, }; if (req.user) details.username = req.user.username; l.error("Error: ", err.message); res.status(500); + res.set({ + "Cache-Control": "no-cache", + }); res.send(err.message); return res.end(); }); @@ -74,4 +79,3 @@ app.use((err, req, res, next) => { server.listen(config.port, () => console.log(`CoinOS Server listening on port ${config.port}`) ); - -- cgit v1.2.3