Best practices for integrating Captcha for services outside the Chinese mainland

更新时间:
复制 MD 格式

If your business scenario requires overseas CAPTCHA integration, this article uses the web integration method as an example to describe the integration process and key precautions for overseas CAPTCHA access.

Prerequisites

  • You have activated the Alibaba Cloud Captcha V2.0 service..

  • You have created a verification scenario where the Integration Method is set to Web/H5..

  • You have Create an AccessKey for your Alibaba Cloud account.

    Important

    Do not use the AccessKey of your Alibaba Cloud account for integration. If the AccessKey of your Alibaba Cloud account is leaked, all cloud resources are at security risk. Use the AccessKey of a RAM user to minimize the impact of permission leaks. Before you integrate with Alibaba Cloud CAPTCHA, grant the RAM user the AliyunYundunAFSFullAccess permission policy for the CAPTCHA service.

Step 1: Client-side integration

After you add a verification scenario in the console, you must integrate the CAPTCHA initialization code into the web or H5 pages where the verification feature is used. For more information, see V2 integration for web and H5 clients.

Important

If the access method is outside the Chinese mainland, pay attention to the following configurations:

  • language: Defaults to cn (Simplified Chinese). CAPTCHA provides 17 language types. You can set custom CAPTCHA text and multi-language settings during client-side integration based on your business needs. For more information, see Customize text and language settings.

  • region: Set to sgp (Singapore). If not set, it defaults to cn (Chinese mainland). If you want to accelerate access in regions outside the Chinese mainland other than Singapore, set it to ga (Global Acceleration).

For more parameter descriptions, see V2 integration for web and H5 clients.

Step 2: Server-side integration

After you complete the client-side integration, you must call the API on the server to initiate verification requests. For more information, see Server-side integration.

Important

If your connection type is for a location outside the Chinese mainland, ensure that the server-side Endpoint and the client Region parameter are both configured for the same location type, either inside China or outside China. Do not mix location types. Mismatched location types will cause validation requests to fail. The configuration rules are as follows:

  1. Configuration for inside China: When the Region parameter is set to cn, use an endpoint in China. Do not use an endpoint outside China.

  2. Configuration for outside China: When the Region parameter is set to sgp (Singapore) or ga (Global Accelerator), use one of the following endpoints outside China. Do not use an endpoint in China:

    • Singapore node: captcha.ap-southeast-1.aliyuncs.com

    • Global Accelerator node (Connects to the nearest point of presence (POP) and routes traffic to Singapore): captcha-open-ga.aliyuncs.com

Important: When you use a Global Accelerator domain name, the client's real source IP address is not passed to the server. Instead, the server receives the IP address of a Global Accelerator node.

Step 3: View verification statistics

After integration, you can query recent verification data on the Overview page to monitor the protection status of your CAPTCHA in real time. For more information, see View statistics.