Skip to content

Commit

Permalink
error on Twilio/Nexmo endpoints so Twilio will try the fallback url
Browse files Browse the repository at this point in the history
  • Loading branch information
schuyler1d committed Aug 29, 2020
1 parent 4589a28 commit e1d377a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/server/downtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ if (process.env.NODE_ENV === "production") {

app.use((req, res, next) => {
if (req.path !== "/downtime") {
res.redirect(302, "/downtime");
if (/twilio|nexmo/.test(req.path) && process.env.DOWNTIME_NO_DB) {
res.status(500).send("Server is down");
} else {
res.redirect(302, "/downtime");
}
} else {
res.send(renderIndex("", "", assetMap));
}
Expand Down

0 comments on commit e1d377a

Please sign in to comment.