简体   繁体   中英

node.js dns.resolveAny returns an empty array

I'm using dns.resolveAny function to check DNS information about some domains.

One thing I found strange is that for some domains, dns.resolveAny returns an empty array while nslookup command doesn't.

Here's an example:

// node.js version >= 9.2 is required

const dns = require('dns')

dns.resolveAny('www.ifshop.com.tw', (err, ret) => {
  if (err) {
      console.log(`err: ${err}`)
  } else {
      console.log(`ret: ${JSON.stringify(ret)}`)  // JSON.stringify(ret) == [] here
  }
})

resolveAny returns [] . But nslookup successfully returns where www.ifshop.com.tw 's CNAME record.

> nslookup www.ifshop.com.tw
Server:     192.168.1.1
Address:    192.168.1.1#53

Non-authoritative answer:
www.ifshop.com.tw   canonical name = s1759.dname.91app.io.
s1759.dname.91app.io    canonical name = proxy.letssl.91app.io.
proxy.letssl.91app.io   canonical name = proxy-letssl-91app-io-196811564.ap-northeast-1.elb.amazonaws.com.
Name:   proxy-letssl-91app-io-196811564.ap-northeast-1.elb.amazonaws.com
Address: 54.178.248.57
Name:   proxy-letssl-91app-io-196811564.ap-northeast-1.elb.amazonaws.com
Address: 52.196.80.17

Why does this happen?

Is this a bug of resolveAny ?

Or is there a problem in the DNS configuration of www.ifshop.com.tw ?

I also found that dns.resolveCname returns CNAME successfully.

// node.js version >= 9.2 is required

const dns = require('dns')

dns.resolveCname('www.ifshop.com.tw', (err, ret) => {
  if (err) {
      console.log(`err: ${err}`)
  } else {
      console.log(`ret: ${JSON.stringify(ret)}`)
  }
})

Here, JSON.stringify(ret) is equal to ["s1759.dname.91app.io"] .

I set the type of nslookup to any . Then I found the following information.

nslookup
> set type=any
> www.ifshop.com.tw
Server:     10.11.1.5
Address:    10.11.1.5#53

Non-authoritative answer:
www.ifshop.com.tw   hinfo = "ANY obsoleted" "See draft-ietf-dnsop-refuse-any"

Authoritative answers can be found from:

From the information above, we can infer that the DNS provider refuse to respond to the queries of any type.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM