HTTPTables
Important Note
Do not use yet in production This module won't probably be heavily maintained. Fork at will or claim ownership ! Okay now you can keep reading :)
Module Status
Description
Kind of a firewall for http requests based on headers. It parses a set of rules for each HTTP header and apply the matching policy
Usage
NB: This module makes the assumption your request object looks like this
req = headers : 'method' : 'PUT' 'url' : '/kung/foo/panda/' 'any-other-header' : 'of_any_value'
If it does not, use the setAccessFieldFunction (look around the end of this readme to see an example)
Example 1: a rule could be represented as such
rule = policy : HTTPTablespoliciesDROP conditions : 'method' : 'POST' 'GET' 'user-agent' : /Android/ 'url' : "/api/v2/users/1"
In this case it will drop every POST or GET requests from android on /api/v2/users/1 url
var HTTPTables = ;var httptables =
Example 2: In Express
var HTTPTables = ;var httptables = // Override the way to access a header field for an express request objecthttptables { var _field = field || ""; iffield === 'URL' return requrl; else iffield === 'METHOD' return reqmethod; else return req; }//...//...//...app // Comming Soon, see commented code in source to implement yourself// only if you want/needapp