Node.js dns.resolve versus dns.lookup over VPN connections

Filed under: Node.js

comments (0) Views: 9,187

I've been working on an application lately that uses Node.js APIs. It's an internal application for Emma and needed access to one of our internal domains, Simon.int. Since we have some employees working remotely this application also needed to work over VPN connection. After doing some research I discovered a mthod within the DNS module called dns.resolve. In my tests locally this method would properly return a success status when attempting to connect to our file server.


var dataDomain = 'simon.int',
    dns = require("dns");

dns.lookup(dataDomain, function(error, addr){
    console.log(addr);
    console.log(error);
});

It turns out that I should have been using dns.lookup instead. Apparently dns.resolve uses internal DNS infrastructure which VPN connections interfere with. The dns.lookup method uses the operating system's getHostName architecture instead.

Amazon logo

If this article was interesting, or helpful, or even wrong, please consider leaving a comment, or buying something from my wishlist. It's appreciated!

comments powered by Disqus