Support net.BlockList
in http.Agent
options
#55000
Labels
feature request
Issues that request new features to be added to Node.js.
net
Issues and PRs related to the net subsystem.
What is the problem this feature will solve?
Enable users to allow or block requests when using
http.request
,fetch
, etc.What is the feature you are proposing to solve the problem?
Node.js already supports
net.BlockList
, it'd be awesome if you could simply pass in an instance ofnet.BlockList
when creating a customhttp.Agent
and then have it automatically enforce the IP checks for you.What alternatives have you considered?
I believe the only way to do this at the moment is a bit boilerplate-y, which would be using a custom
lookup
function that callsdns.lookup(hostname)
manually, then callsblocklist.check(address)
manually, and then if it flags, throw an error, else return the address.Although that still isn't a complete solution because the
lookup
function isn't called for hostnames that are already IP addresses, so even more code to do the check fully :(The text was updated successfully, but these errors were encountered: