syv
syv

Reputation: 3608

Http Filter in Node.js

I want to filter http requests and allow only calls from certain domains which I'm interested in. Is it possible to do it as part of App Configuration? - Any libraries available for this?

Upvotes: 0

Views: 592

Answers (1)

ebohlman
ebohlman

Reputation: 15003

req.connection.remoteAddress will have the IP address of the system making the request; you can do a reverse DNS lookup on it and match against the returned domains. If you're using express or connect you can write a middleware function to do this.

Upvotes: 1

Related Questions