# Weixin Mini Program One-key access

Welcome to the WeChat WeChat Gateway, and below we will detail the steps to quickly access the Weixin Mini Program WeChat Network, protect business data and interfaces, defend against external malicious traffic, and improve business access quality.The entire integration is completed in 1-3 minutes, without code modification, without redistribution, and without affecting business-line operations.

In addition, we have also launched a video course, so you can go to the video course at the bottom of the document to learn this part.

# I. Access steps

# 1. WeChat Scan the code to log in WeChat developer platform

Select "My Services - WeChat Gateway," click "Go to Access," or select "Network Link - WeChat Gateway," or go to "Details - [[PIPS-0]] - Service Scope - WeChat Gateway."

# 2. If you log in for the first time and there is no WeChat gateway space under the current WeChat number, you need to create WeChat gateway space first.

If there is no Weixin Mini Program under the current WeChat, you need to go to the WeChat Official Platform to register a Mini Program, and then return to the WeChat gateway home page to access; If there is a WeChat Gateway space under WeChat but no WeChat Gateway, the platform will select the first WeChat Gateway space by default and create a WeChat Gateway under this space.Supports manual space switching; If there is a WeChat gateway space under the current WeChat number and there is a WeChat gateway, the platform will connect Weixin Mini Program to the WeChat gateway by default;

  • Can switch different Weixin Mini Program access in the WeChat gateway home page drop-down box in the upper right corner;
  • The WeChat gateway by default connects the Weixin Mini Program experience version to the WeChat gateway private link of WeChat, which completely does not affect online traffic, and is only used as a test application for the Mini Program experience version, please rest assured to access;
  • If you choose Weixin Mini Program without the experience version, please re-select the experience version of the Mini Program access, or to the current Mini Program push the experience version try to access again;
  • If the selected Weixin Mini Program does not configure the request valid domain name on the WeChat public platform , You need to go to the "WeChat Official Platform - development - development management - development settings - server domain name - request legal domain name" configuration;
  • If the number of request valid domain names is more than 20 in the "Weixin Mini Program" configuration of the "WeChat" public platform, the platform will default to take the first 10 domain names requested on the line;
  • If the current WeChat number is not selected Weixin Mini Program administrator, you need the Mini Program administrator to scan the code authorization;

# 4. Once the access is successful, you go to the Gateway Overview page

  • Weixin Mini Program After successful one-click access, all requests for the mini program experience version will be protected by the "WeChat private link" of the WeChat gateway and forwarded to the mini program;

# 5. Weixin Mini Program On-Line version access WeChat gateway, Click "Go to Access Configuration" to enter the Business Configuration page, select the target Mini Program click "Modify," select the access version "All Versions," select all Mini Programs URL and submit to quick access online.

The list of access versions and details are as follows:

  • Full version: including Weixin Mini Program online version, experience version, development version 3 versions;
  • Experience version: Only the Weixin Mini Program experience version requests access to the WeChat gateway;
  • Development version: Only the Weixin Mini Program development version requests access to the WeChat gateway;

In addition, each service configuration has an independent access switch, after closing access switch Weixin Mini Program all requests are not connected to WeChat gateway, directly go to the original public network, do not enjoy the WeChat gateway safety protection and quality of service optimization capabilities.

# 5. Weixin Mini Program On-Line traffic gray access WeChat gateway, supporting interface dimension gray access.

  • Weixin Mini Program URL , WeChat WeChat gateway has opened WeChat Official Platform , automatically pull the Mini Program corresponding to the request legal domain name;
  • You can access the WeChat gateway according to the business situation, supporting part "Weixin Mini Program URL";
  • Supports the addition of more than one path under the same domain name, and matches by prefix when the path is empty;
  • If you want to add a new Weixin Mini Program domain name, please go to "WeChat public platform - request legal domain name" to add, and then return to the corresponding "access domain name" operation;
  • Weixin Mini Program URL Supports 20 configurations (higher specification versions, this limit will be increased, see detailed instructions in billing documentation)

When configuring greyscale access, you should pay attention to the following:

  1. Cannot configure different gray scale or different user groups for the same path
  2. Unconfigurable nested paths, such as/ a / band/ a

# II. FAQS

# 1. After using Weixin Mini Program one-click access to WeChat gateway, do you still need a Mini Program version?

A: There is no need for Weixin Mini Program distribution, no need to modify the Mini Program code, and Mini Program traffic will be accessed to the WeChat gateway according to your configuration and protected and optimized by the WeChat Gateway private link.

# 2. If the incoming Weixin Mini Program traffic is larger than the WeChat gateway package specification, what happens to the excess traffic?

A: The excess traffic will go to the original business public network link, no longer protected and optimized by the WeChat gateway WeChat private link, it is recommended to upgrade the WeChat gateway package;WeChat Gateway will not block / intercept and discard normal Weixin Mini Program traffic.

# 3. What if I don't want to use the WeChat gateway anymore?

A: WeChat gateway supports Weixin Mini Program fast disconnect access, after fast disconnect the Mini Program flow will go directly to the original business public network link, the flow is not blocked; The operating path is "Business configuration - target Mini Program - disconnect quickly," or "Business configuration -- target Mini Program -- modify - close access switch - submit";

A: The gateway link's errmsg value is gateway.call: ok. In addition, there is a callid at the return body root level. It is recommended to record and report this callid at Weixin Mini Program end. Problems with the link can be pinpointed to the WeChat gateway team using this callid.The server receives a specific header for the safety link:

  • X-wx-call-id: Link request ID, consistent with the front-end response, which can be used to contact the front-end logs. Feedback questions are also preferred this one.
  • X- wx-route-tag: access domain mark, according to this judge different access domain forwarding traffic, used to treat different
  • X-wx-source: Request a Guest, e.g. WeChat The Guest is wx_client, and the Developer Tools are wx_devtools
  • X-wx- AppID: request Weixin Mini Program, appid Mini Program marking the request
  • X-envoy-expected-rq-timeout-ms: gateway parameter, response timeout time, usually 15 seconds

For security considerations, other header information about the gateway, please find after access, if you have any questions, please contact us 1v1 answer.(Different Weixin Mini Program accesses may have special headers.)

Depending on your security requirements, you can set up a whitelist by x-wx- AppID and x-wy-route-tag, which only accepts requests from whitelist access domains or whitelist Weixin Mini Program.

A: There are probably two reasons: A. The link takes effect within 1 minute, and if the user is accessing the Weixin Mini Program, you need to wait for the next boot to open. If the developer tests the validation, it is recommended to exit the WeChat background, go back to try again, and if it still doesn't work, remove the Mini Program and try again (remove the Mini Program mainly to clear the cache)

B. Weixin Mini Program one-key access mode, not yet covered the PC side Mini Program / lower than 3.0.2 basic library version Mini Program, please verify the mobile phone side.

A: The developer tool corresponds to the "Developed Edition." You need to ensure that you access the configuration to the "Development Edition." If you still cannot configure, wait a minute to try again. Generally clearing the cache + restarting the developer tools can be done. The base library version needs to be 3.1.5 and above, and the developer tool version needs be 1.06.2310312 and above.

# 7. Why is the time of requests through the WeChat gateway significantly increased after accessing Weixin Mini Program?(Appside requests are getting slower)

A: Probably there are two reasons:

A. Cross-domain conditions exist between the gateway access area and the Weixin Mini Program service deployment area, resulting in increased time spent on cross-domain requests;At present, the WeChat gateway has been launched to select the "access region" capability, currently supports the selection of "Shanghai," "Shenzhen," "Tianjin" 3 regions, and will support more in the future;To avoid long-range cross-domain requests that can cause time-consuming requests, select the access gateway location nearer. For example, if the Mini Program server is deployed in Shenzhen, select the Shenzhen region; The Mini Program service is deployed in Beijing, please select the Tianjin region nearest.

B. The bandwidth of the business request exceeds the bandwidth limit of the free trial version, which is currently 1 Mbps;You can go to the WeChat Gateway Console - Monitoring View - Package Monitoring to view the Over-Package Bandwidth Requests view and adjust the size of the business request callback to avoid bandwidth overload;

# 8. What version is one-click access supported?

Base library version: 3.0.2 and above

Mobile system: Android, iOS, Hongmeng

If you have other questions, you can go to WeChat developer community - WeChat gateway area for feedback.