# Mobile resolution HttpDNS

From the basic library 2.19. 2 Start to support

When the developer calls wx.request, the mobile resolution HttpDNS service can be turned on. The service sends a domain name resolution request to the service provider’s DNS server based on the Http protocol, instead of the traditional way of initiating a resolution request to the operator’s Local DNS based on the DNS protocol. It can avoid domain name hijacking and cross-network access problems caused by Local DNS, and solve the mobile Internet. The trouble caused by abnormal domain name resolution in the service.

# Mini program developers use mobile analysis instructions

  1. Go to WeChat Service Platform to purchase HttpDNS resources, and obtain the Service ID from the service details page-access document.
  2. The applet calls wx.request, sets the enableHttpDNS parameter to true, and fills in the selected service provider Service ID in the httpDNSServiceId parameter.

# Code example

wx.request({
  url:'example.php', //just an example, not the real interface address
  enableHttpDNS: true,
  httpDNSServiceId:'wxa410372c837a5f26',
  success(res) {
    console.log('request success', res)
  },
  fail(res) {
    console.error('request fail', res)
  }
})

# Billing instructions

  1. The cost of using the service will be charged according to the actual call to the service provider's interface. The pricing strategy is determined by the service provider, and the developer needs to go to the WeChat service platform to purchase, renew, and other operations.
  2. Every time the WeChat side calls the service provider interface on behalf of a developer, the WeChat side will cache. The caching strategy is determined by the ttl returned by the service provider, so it may not necessarily incur costs every time the request interface is called.
  3. If the developer’s service available quota is 0 and the mobile parsing capability provided by the service provider is still declared in the wx.request interface, an error will be triggered, please follow the error Code properly.
Error code Description
600000 Network error
602000 Network request error
602001 System error
602002 http request httpdns service provider error
602101 Mini Program did not purchase httpdns service in the service market
602102 The applet has expired in the httpdns service market resource pack
602103 Insufficient amount of applet in httpdns service market
602104 httpdns service provider returns empty results
602105 The result of calling httpdns service provider timed out
602106 The data returned by the httpdns service provider is illegal
602107 httpdns domain name resolution result is empty
602108 Unsupported httpdns service provider id

# Mobile analysis service provider access instructions

In order to protect the security of the WeChat client, the mobile analysis service used by the applet needs to pass the WeChat side security authentication, and the authentication can be put on the WeChat service platform.

WeChat welcomes more service providers to provide mobile analysis services for Mini Programs. To apply for access, send an email according to the following template, and we will have someone contact you.

To: servicemarket@tencent.com
Subject: [Launching Service Platform] XXX (Service Provider) applies for HttpDNS service
Main text: The basic information of the service provider needs to be stated, including but not limited to the name of the service provider, business scope, technical certificate, cooperation intention, contact information, etc.