Don't log HTTP 413, just send it to the client and be done
This commit is contained in:
parent
a3a9fa074e
commit
e8a2753e19
2 changed files with 63 additions and 1 deletions
|
|
@ -204,7 +204,10 @@ module.exports = {
|
|||
req._ip = ipForRequest(req);
|
||||
next();
|
||||
});
|
||||
app.use(bodyParser.urlencoded({ extended: false }));
|
||||
app.use(bodyParser.urlencoded({
|
||||
extended: false,
|
||||
limit: '1kb' // No POST data should ever exceed this size under normal usage
|
||||
}));
|
||||
app.use(cookieParser());
|
||||
app.use(morgan(LOG_FORMAT, {
|
||||
stream: require("fs").createWriteStream(path.join(__dirname, "..", "..",
|
||||
|
|
@ -247,6 +250,8 @@ module.exports = {
|
|||
return res.status(400).send("Malformed path: " + req.path);
|
||||
} else if (err.message && err.message.match(/requested range not/i)) {
|
||||
return res.status(416).end();
|
||||
} else if (err.message && err.message.match(/request entity too large/i)) {
|
||||
return res.status(413).end();
|
||||
} else if (err.message && err.message.match(/bad request/i)) {
|
||||
return res.status(400).end("Bad Request");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue