Skip to content

Commit

Permalink
return error code directly without waiting for data end being called,…
Browse files Browse the repository at this point in the history
… if original server returns error
  • Loading branch information
netptop committed Mar 15, 2020
1 parent 9ad9bdc commit b0ffd82
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ let Proxy = ({urlModify, httpprefix, serverName, port, cookieDomainRewrite, loca
});
res.statusCode = proxyRes.statusCode
logSave(`res.status:${res.statusCode} res.url:${res.url}, res.headers:${JSON.stringify(res.getHeaders())}`)
if (res.statusCode >= 400) {
res.status(res.statusCode).send("")
return
}
},
onProxyReq: (proxyReq, req, res) => {
let myRe = new RegExp(`/${httpprefix}/${serverName}.*?/`, 'g') // match group
Expand Down

0 comments on commit b0ffd82

Please sign in to comment.