Cloud-native gateways process requests through a pipeline of plug-ins. When the built-in plug-ins do not cover your requirements -- such as custom authentication logic, request transformation, or traffic filtering -- you can develop a WebAssembly (Wasm) plug-in and upload it to the Plug-in Marketplace in the Microservices Engine (MSE) console. Once uploaded, the plug-in is available to your Alibaba Cloud account and any RAM users with permissions on the gateway. Custom plug-ins and built-in plug-ins are enabled the same way.
Prerequisites
Before you begin, make sure that you have:
A cloud-native gateway created in the MSE console
A compiled
.wasmplug-in binary file (max 50 MB)Permissions to access the cloud-native gateway
Upload the plug-in
Log on to the MSE console. In the top navigation bar, select a region.
In the left-side navigation pane, choose Cloud-native Gateway > Gateways. On the Gateways page, click the name of the gateway.
In the left-side navigation pane, click Plug-in Marketplace.
On the Plug-in Marketplace page, click the Custom subtab on the All Plug-ins tab, and then click Add Plug-in.
In the Add Plug-in panel, configure the following parameters and click OK. The release process takes about 30 seconds.
Parameter Description Plug-in Name A unique name for the plug-in. Plug-in Description A short description displayed on the plug-in card. WebAssembly Language The programming language used to develop the plug-in. Select a language from the drop-down list. WebAssembly File The compiled .wasmbinary file from your on-premises machine. The filename extension must be.wasmand the file size cannot exceed 50 MB.Plug-in Execution Stage The stage at which the plug-in runs in the request processing pipeline. Stages run in this order: Authorization > Authentication > Statistics > Default. Select Default if the plug-in does not depend on the execution order of other plug-ins. For details, see Plug-in execution order. Plug-in Execution Priority The priority of the plug-in within its assigned stage. A larger value means higher priority. Keep the default value if the plug-in does not depend on the execution order of other plug-ins. To set a custom value, use a multiple of 10.
Plug-in execution order
You can determine the relative execution order of multiple plug-ins based on two settings:
Execution stage -- determines the broad phase. Stages run in this fixed order: Authorization > Authentication > Statistics > Default.
Execution priority -- determines the order within a stage. A larger value runs first.
The execution order for responses is the reverse of the request order. The first plug-in to process a request is the last plug-in to process the response.
To check the stage and priority of a built-in plug-in, open its details page. If your custom plug-in must run before or after a specific built-in plug-in, set Plug-in Execution Stage and Plug-in Execution Priority accordingly.
FAQ
How do I update the .wasm file of a plug-in?
Disable the plug-in first. On the plug-in card, click the settings icon and select Edit to upload a new .wasm file.
Custom plug-ins can only be edited or deleted when disabled. Built-in MSE plug-ins cannot be edited or deleted.
Why did my plug-in release fail?
The most common cause is an invalid .wasm binary format. Verify the file by loading it in your local environment before uploading. For a working example, see Use Go to develop gateway plug-ins.