Improved error handling of code executed behind the WAF.
This commit is contained in:
parent
aaee98e508
commit
90ccd1cd77
2 changed files with 21 additions and 8 deletions
17
index.js
17
index.js
|
@ -117,15 +117,28 @@ Mod.prototype.callback = function callback(req, res, serverconsole, responseEnd,
|
|||
easyWaf(req, res, function() {
|
||||
if (((href == "/easywaf-config.json" || (os.platform() == "win32" && href.toLowerCase() == "/easywaf-config.json")) || (href == "/easywaf-hooks.js" || (os.platform() == "win32" && href.toLowerCase() == "/easywaf-hooks.js"))) && __dirname == process.cwd()) {
|
||||
if (callServerError) {
|
||||
callServerError(403, "easy-waf-integration/1.2.0");
|
||||
callServerError(403, "easy-waf-integration/1.2.1");
|
||||
} else {
|
||||
res.writeHead(403, "Forbidden", {
|
||||
"Server": "SVR.JS"
|
||||
"Server": "SVR.JS",
|
||||
"Content-Type": "text/plain"
|
||||
});
|
||||
res.end("403 Forbidden!");
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
elseCallback();
|
||||
} catch (ex) {
|
||||
if (callServerError) {
|
||||
callServerError(500, "easy-waf-integration/1.2.1", ex);
|
||||
} else {
|
||||
res.writeHead(500, "Internal Server Error", {
|
||||
"Server": "SVR.JS",
|
||||
"Content-Type": "text/plain"
|
||||
});
|
||||
res.end(ex.stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
2
mod.info
2
mod.info
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"name": "Integration with EasyWAF",
|
||||
"version": "1.2.0"
|
||||
"version": "1.2.1"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue