# Mini Program One Key Access
Welcome to the WeChat Security Gateway, the following will introduce the WeChat Mini Program quick access to the security gateway, the use of security gateways to protect business data and interface security, resist external malicious traffic and improve the quality of business access steps. The entire access will be 1-3 Complete within minutes, no need to modify the code, no need to re-release the version, and does not affect the operation of the business line.
You can watch the video lesson to learn this part:
<a href="https://developers.weixin.qq.com/community/business/doc/00082093500fb88faef1689616680d target="_blank" data-ctabtn>
# I. Access Steps
# 1. WeChat scan code login Donut Security Gateway Console, agree to the Security Gateway Service Agreement and agree to complete the opening immediately.
# 2. Get intoSecurity gatewayPage, drop down to select AccessSecurity gatewayMini Program, start plugging in.
- If the Mini Program is not authorized to the current Donut Space, clickAuthorize other Mini programsTo authorize, after the authorization is successful, return to the current page to select
- The security gateway will access the mini program experience version to the security gateway WeChat private link by default, which does not affect online traffic at all, and is only used as a test use of the mini program experience version.
- If the selected Mini Program has no experience version, please re-select the Mini Program with experience version.
- If the selected Mini Program is not in theWeChat Official PlatformTo configure request Legitimate domain name, you need to go toWeChat Public Platform - Development - Development Management - Development Settings - Server domain name - request legal domain nameIn the configuration can be
- Such as the selected Mini Program in theWeChat Official PlatformConfigured request The number of legitimate domain names exceeds 20, and the platform will take the first 10 domain names requested online by default.
- If the selected Mini Program has been bound to a gateway in another space, please re-select the Mini Program that has not been bound to a gateway.A Mini Program can only be bound to a gateway
# 3. 3, WeChat scan code Mini Program experience version, initiate a request to view the security gateway link state.
- After the Mini Program is successfully accessed with one key, all requests for the Mini Program experience version will be handled by the security gateway.WeChat private linkProtected and forwarded to the Mini Program server
- After the Mini Program is successfully accessed with one key, it will return the two-dimensional code of the Mini Program Experience Version. You can scan the code on WeChat to see the status of the Mini Program Experience Version after accessing the gateway, and you can also initiate a request to check whether the link is normal.
- Scan code Mini Program experience version after the request, the request related data can be found in the gateway'sMonitoring viewView in
- to hitcompleteContinue to experience more security gateway capabilities
- The follow-up will support more gateway effect experience, please look forward to
# 4. Mini Program online version access security gateway, clickmodifyGo to the access domain name details page, access version selectionAll versions, select all Mini Program URL, submit can be quickly online access.
- Access version
- All versions, including Mini Program online version, experience version, development version 3 One version
- Experience version, only Mini Program experience version request access to security gateway
- Development version, Mini Programs Development Version only request access to security gateway
- No access, that is, all version requests of the Mini Program are not connected to the security gateway to take the WeChat private link, and take the original public network link, will not be able to enjoy the security protection and weak network optimization capabilities of the security gateway.
# 5. Mini Program online traffic gray access security gateway, support interface dimension gray access.
- Mini Program URL, WeChat security gateway has been openedWeChat Official Platform, automatically pull the Mini Program corresponding request Legal domain name
- You can follow the business situation, the support sectionMini Program URLAccess Security Gateway
- Support to add multiple paths under the same domain name, when the path is empty, it will match the prefix by default
- To add a new Mini Program domain name, go to theWeChat Official Platform - request Legal domain nameAdd, and return the correspondingAccess domainI can do it.
- The number of Mini Program URLs supports configuration of 20
# II. Frequently Asked Questions
- After using the Mini Program to access the security gateway with one key, do you still need the Mini Program release version?
- A: You do not need to modify the Mini Program code, the Mini Program traffic will access the security gateway according to your configuration, protected and optimized by the security gateway WeChat private link.
- If the access Mini Program traffic is greater than the security gateway package specifications, how to deal with the excess traffic?
- A: The excess traffic will go through the original service public network link, no longer subject to the security gateway WeChat private link protection and optimization, it is recommended to upgrade the security gateway packageSecurity gateways do not block/Intercept and discard normal Mini Program traffic.
- If you no longer want to use the security gateway, how do you do it?
- A: The security gateway supports the rapid disconnection of the Mini Program, and the traffic of the Mini Program will go directly to the original business public network link after the rapid disconnection, and the traffic will not be blocked.Operation pathAccess layer - access domain name - target Mini Program - quick disconnect, or,Access layer - access domain name - modify - Mini Program version does not access - submit
- How do I tell if a request has passed through a gateway link?
A: The errmsg value for the gateway link is gateway.call: ok, In addition, there will be callid at the root level of the return body, it is recommended to record and report the callid at the Mini Program side, and the link problem can be fed back to the security gateway team with 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 also preferred this.
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 account, such as WeChat guest account is wx_Client, the developer tool is wx_devtools
Xwxappid: request Mini Program, appid that marks the request
X-envoy-expected-rq-timeout-ms: gateway parameter, response timeout time, usually 15 seconds
According to its own security requirements, you can set up a whitelist through x-wx-appid, x-wx-route-tag, and only accept requests from whitelist access domains or whitelist Mini Programs.
- Why is the access configuration, the corresponding version of the Mini Program access or the native link, without a secure link?
- A: The link takes effect within 1 minute, if the user is accessing the Mini Program, you need to wait for the next startup to open. If the developer test verification, it is recommended to exit the WeChat background, re-enter and try again, if still can not, delete the Mini Program and then reload the attempt (delete the Mini Program is mainly to clear the cache)
- Why did the WeChat developer tool not take the security link after the access configuration?
- A: The developer tools correspond to theDevelopment version, need to guarantee that access is configured toDevelopment versionIf it is still not possible after configuration, wait one minute and try again. Generally clear the cache + restart the developer tools can be done. The base library version needs to be 3.1.5 and above, and the developer tools version needs to be 1.06.2310312 and above.
- Why does the request time through the security gateway increase significantly after accessing the Mini Program? (The Mini Program side request becomes slow)
- A: It could be for two reasons:
- a. Gateway access region and Mini Program server deployment region exist cross-domain situation, resulting in increased time consuming due to cross-domain requestsSecurity Gateway is currently online SelectAccess region Ability, Current Support SelectionShanghai、Shenzhen、TianjinThree regions, and more will be supportedTo avoid long distance cross-domain request time, please select the nearest access gateway region. For example, the Mini Program server is deployed in Shenzhen, please select Shenzhen regionMini Program server deployment in Beijing, please select the nearest Tianjin region.
- b. The service request bandwidth exceeds the bandwidth limit of the free trial version, which currently has a bandwidth limit of 1MbpsYou can go toSecurity Gateway Console - Monitoring View - Package MonitoringView inExcess of package bandwidth requestsView the situation, and adjust the packet size of the next business request to avoid bandwidth overruns