1.0.1 • Published 6 years ago

httpaddr v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Build Status Coverage Status Version License Code style

Motivation

Filter HTTP remote address through a list of CIDR (with proxies white list support)

API

const allow = require('httpaddr');


var server = http.createServer(function(req, res) {
  var allowed = allow(req, ["127.0.0.1/32"]);
  console.log("Allow only from localhost");

  var allowedproxy = allow(req, ["127.0.0.1/32"], ["someproxies/24"]);
  console.log("Allow only from allowedproxy");
});


server.listen(8080);

Notes

CIDR are filtered through the ipaddr.js module

Credits