Skip to content

Commit

Permalink
block _all_dbs
Browse files Browse the repository at this point in the history
* * *

This commit was sponsored by Human JavaScript.
Human JavaScript is the best way to learn modern
web application development today, read it now:

http://go.hood.ie/human-javascript
  • Loading branch information
janl committed Nov 29, 2013
1 parent 3380b8c commit f450125
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/middleware/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ module.exports = function (config) {
if (!/^\/_api/.test(req.url)) {
return next();
}

// block /_api/_all_dbs
if (/^\/_api\/_all_dbs/.test(req.url)) {
var body = '{"error":"not found"}\n';
res.writeHead(404, {
'Content-Length': body.length,
'Content-Type': 'application/json'
});
res.end(body);
return;
}

// remove the /_api part from url before proxying
var url = req.url.substr('/_api'.length);
// proxy request to CouchDB
Expand Down

0 comments on commit f450125

Please sign in to comment.