7.5k
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill alibaba/higress --skill higress-wasm-go-plugin- SKILL.md7.3 KB
Overview
This skill helps you develop Higress WASM gateway plugins using Go 1.24+ and the higress wasm-go SDK. It targets HTTP request/response processing, external service calls, Redis integration, and custom gateway logic for AI-native API gateways. The content provides templates, lifecycle details, API reference, and common patterns to accelerate plugin development and debugging.
How this skill works
The skill shows how to register a plugin, parse per-route or global YAML config (auto-converted to JSON), and implement handlers for HTTP lifecycle phases (request headers/body, response headers/body, stream done). It documents the proxywasm APIs for header/body manipulation, direct responses, flow control (pause/resume), and context storage. Examples include making asynchronous cluster HTTP calls and Redis access with built-in flow control and timeout patterns.
When to use it
- Creating a new Higress WASM plugin in Go to inspect or modify HTTP traffic
- Adding external service validation or enrichment (HTTP calls, Redis) inside the gateway
- Implementing request/response body transformations or streaming processing
- Debugging plugin lifecycle, flow control, or header/body access issues
- Building multi-level configurable plugins (global/domain/route) that rely on parsed config
Best practices
- Register plugin and handlers in init() using wrapper.SetCtx to ensure lifecycle hooks are set
- Parse per-request config with parseConfig; control plane supplies the effective config
- Never call Resume after SendHttpResponse — responses auto-resume after send
- Check HasRequestBody()/HasResponseBody() before using HeaderStopIteration to avoid deadlocks
- Return HeaderContinue on external call errors to fail open and avoid blocking requests
- Set explicit timeouts for cluster/HTTP calls (default is short) and handle timeouts gracefully
Example use cases
- Append a custom header on inbound requests when a route-level flag is enabled
- Call an authentication service during request headers phase; block or allow based on result
- Fetch rate limit state from Redis and return 429 when quota is exceeded
- Stream and transform response bodies for content filtering or watermarking
- Implement periodic health or leader-election tasks using tick functions for background work
FAQ
Use GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o main.wasm after adding the higress wasm-go SDK and proxy-wasm-go-sdk dependencies.
Can I buffer request or response bodies?
Yes. Use ctx.BufferRequestBody() or ctx.BufferResponseBody() to buffer instead of streaming, and only access body data in the body phase.