How to solve the time-out when Mini Program server requests Wechat server
This article mainly explains "how to solve the Mini Program server request Wechat server timeout", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "Mini Program server request Wechat server timeout how to solve" it!
In a directory, create a new file, such as curl-format.txt, with the following contents:
Time_namelookup:% {time_namelookup}\ ntime_connect:% {time_connect}\ ntime_appconnect:% {time_appconnect}\ ntime_pretransfer:% {time_pretransfer}\ ntime_redirect:% {time_redirect}\ ntime_starttransfer:% {time_starttransfer}\ n -\ ntime_total:% {time_total}\ n
In the same directory, perform the curl operation:
Curl- w "@ curl-format.txt"-o / dev/null-s "https://api.weixin.qq.com/sns/jscode2session?xxx=xxx&xx=aa"
The results are as follows:
Checked on the Internet, the meanings of each field are as follows (in seconds):
Time_namelookup: when DNS domain names are resolved, it is the process of translating https://zhihu.com into ip addresses.
Time_connect: the time when the TCP connection is established is the time of the three-way handshake
Time_appconnect: time for upper layer protocols such as SSL/SSH to establish a connection, such as the time of connect/handshake
Time_pretransfer: the time from the start to the last request transaction
Time_redirect: the time from the start of the request to the start of the response transmission
Time_starttransfer: the time from the request to the first byte to be transferred
Time_total: the total time spent on this request
As can be seen from the screenshot above, it took only 5 seconds to resolve the DNS domain name on our server. No wonder it timed out.
If you find a problem, first modify the / etc/hosts file on the machine, write a dead IP resolution of the Wechat domain name, and fix the problem temporarily.
At this point, I believe that the "Mini Program server request Wechat server timeout how to solve" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!