Attach a plug-in to an API group

更新时间:
复制 MD 格式

Attach a plug-in to an API group so that the plug-in takes effect on all APIs in the group.

1. Overview

A plug-in is an independent configuration component in API Gateway that extends API features with additional customization options. A plug-in must be attached to an API to take effect. If you have many APIs, attaching plug-ins individually can be tedious and time-consuming. To simplify this, API Gateway lets you attach plug-ins to API groups. A plug-in attached to an API group takes effect on all APIs in the group. If an API also has a plug-in of the same type attached directly, the API-level plug-in takes priority.

2. Rules

  • An API group can be attached to only one plug-in of the same type.

  • When a plug-in is attached to a specific environment of an API group, the plug-in policy is automatically applied to all published APIs in that environment.

  • If an API and its group have plug-ins of the same type, the API-level plug-in takes priority.

  • Plug-in changes such as attaching, detaching, and updating take effect in real time. You do not need to republish the API. For high-risk APIs, first verify the changes in the staging environment.

  • A plug-in cannot be deleted if it is attached to an API group.

3. Quick start

  1. Log on to the API Gateway console. In the navigation pane on the left, choose API Management > Plug-in Management.

  2. In the upper-right corner, click Create Plug-in. On the page that appears, specify a custom Plug-in Name, select a Plug-in Type, and configure the plug-in rules.

  3. After you configure the plug-in rules, click Create. The new plug-in appears in the plug-in list.

  4. In the Actions column of the target plug-in, click Attach to Group. Select the group and environment.

  5. After the plug-in is attached, select a published API in the group and test it to verify that the plug-in works.

  6. Test other APIs in the group to verify that the plug-in works.

Important

If an API and its group have plug-ins of the same type, the API-level plug-in takes precedence and overwrites the group-level plug-in.

4. Limits

  • The metadata of a single plug-in cannot exceed 50 KB.

  • Each user can create a maximum of 1,000 plug-ins in each region.

  • The debugging feature in the console does not support the JSON Web Token (JWT) plug-in. Use Postman or the curl command to test the plug-in.