Skip to content

Commit

Permalink
return 404 for ENOTFOUND error
Browse files Browse the repository at this point in the history
  • Loading branch information
netptop committed Mar 14, 2020
1 parent 777b974 commit 9fbbedd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,10 @@ let Proxy = ({urlModify, httpprefix, serverName, port, cookieDomainRewrite, loca
changeOrigin: true,
debug:true,
onError: (err, req, res) => {
logSave(`onerror: ${JSON.stringify(err)}`)
console.log(`onerror: ${JSON.stringify(err)}`)
try {
if ((err.code && err.code === 'ECONNREFUSED') ||
(err.code && err.code === 'ENOTFOUND') ||
(err.reason && err.reason.indexOf('Expected') === -1)) {
res.status(404).send(`{"error": "${err}"}`)
}
Expand Down

0 comments on commit 9fbbedd

Please sign in to comment.