Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
alibaba avatar

Higress Wasm Go Plugin

  • 35 installs
  • 9k repo stars
  • Updated August 4, 2026
  • alibaba/higress

higress-wasm-go-plugin is a Claude skill that guides building Higress gateway WASM plugins in Go using the wasm-go SDK for HTTP request/response processing.

About

This skill guides development of Higress gateway WASM plugins written in Go using the wasm-go SDK. A developer uses it when creating, modifying, or debugging plugins that process HTTP request and response headers or bodies, make external service calls, or integrate with Redis. It provides project setup, a minimal plugin template, the plugin lifecycle phases, and a proxywasm API reference.

  • Scaffolds Higress gateway WASM plugins in Go 1.24+ with the wasm-go SDK
  • Covers HTTP request/response header and body processing phases
  • Includes external HTTP call and Redis integration patterns

Higress Wasm Go Plugin by the numbers

  • 35 all-time installs (skills.sh)
  • Ranked #3,328 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

higress-wasm-go-plugin capabilities & compatibility

Capabilities
api development · backend
Works with
redis
Use cases
api development · debugging
Pricing
Free
From the docs

What higress-wasm-go-plugin says it does

Develop Higress WASM plugins using Go 1.24+. Use when creating, modifying, or debugging Higress gateway plugins for HTTP request/response processing, external service calls, Redis integration, or cust
SKILL.md
Develop Higress gateway WASM plugins using Go language with the `wasm-go` SDK.
SKILL.md
npx skills add https://github.com/alibaba/higress --skill higress-wasm-go-plugin

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs35
repo stars9k
Last updatedAugust 4, 2026
Repositoryalibaba/higress

What it does

Build and debug custom Higress gateway WASM plugins in Go for HTTP request/response processing and external service calls.

Who is it for?

Developers writing custom Higress gateway plugins in Go for header/body manipulation or external service calls

When should I use this skill?

When creating, modifying, or debugging Higress gateway WASM plugins in Go

What you get

A working Go WASM plugin that processes HTTP requests/responses on the Higress gateway

  • Higress WASM Go plugin
  • plugin config parsing
  • HTTP request/response handlers

By the numbers

  • 5 plugin lifecycle phases (Request/Response Headers, Request/Response Body, Stream Done)

Files

SKILL.mdMarkdownGitHub ↗

Higress WASM Go Plugin Development

Develop Higress gateway WASM plugins using Go language with the wasm-go SDK.

Quick Start

Project Setup

# Create project directory
mkdir my-plugin && cd my-plugin

# Initialize Go module
go mod init my-plugin

# Set proxy (China)
go env -w GOPROXY=https://proxy.golang.com.cn,direct

# Download dependencies
go get github.com/higress-group/proxy-wasm-go-sdk@go-1.24
go get github.com/higress-group/wasm-go@main
go get github.com/tidwall/gjson

Minimal Plugin Template

package main

import (
    "github.com/higress-group/wasm-go/pkg/wrapper"
    "github.com/higress-group/proxy-wasm-go-sdk/proxywasm"
    "github.com/higress-group/proxy-wasm-go-sdk/proxywasm/types"
    "github.com/tidwall/gjson"
)

func main() {}

func init() {
    wrapper.SetCtx(
        "my-plugin",
        wrapper.ParseConfig(parseConfig),
        wrapper.ProcessRequestHeaders(onHttpRequestHeaders),
    )
}

type MyConfig struct {
    Enabled bool
}

func parseConfig(json gjson.Result, config *MyConfig) error {
    config.Enabled = json.Get("enabled").Bool()
    return nil
}

func onHttpRequestHeaders(ctx wrapper.HttpContext, config MyConfig) types.Action {
    if config.Enabled {
        proxywasm.AddHttpRequestHeader("x-my-header", "hello")
    }
    return types.HeaderContinue
}

Compile

go mod tidy
GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o main.wasm ./

Core Concepts

Plugin Lifecycle

1. init() - Register plugin with wrapper.SetCtx() 2. parseConfig - Parse YAML config (auto-converted to JSON) 3. HTTP processing phases - Handle requests/responses

HTTP Processing Phases

PhaseTriggerHandler
Request HeadersGateway receives client request headersProcessRequestHeaders
Request BodyGateway receives client request bodyProcessRequestBody
Response HeadersGateway receives backend response headersProcessResponseHeaders
Response BodyGateway receives backend response bodyProcessResponseBody
Stream DoneHTTP stream completesProcessStreamDone

Action Return Values

ActionBehavior
types.HeaderContinueContinue to next filter
types.HeaderStopIterationStop header processing, wait for body
types.HeaderStopAllIterationAndWatermarkStop all processing, buffer data, call proxywasm.ResumeHttpRequest/Response() to resume

API Reference

HttpContext Methods

// Request info (cached, safe to call in any phase)
ctx.Scheme()   // :scheme
ctx.Host()     // :authority
ctx.Path()     // :path
ctx.Method()   // :method

// Body handling
ctx.HasRequestBody()        // Check if request has body
ctx.HasResponseBody()       // Check if response has body
ctx.DontReadRequestBody()   // Skip reading request body
ctx.DontReadResponseBody()  // Skip reading response body
ctx.BufferRequestBody()     // Buffer instead of stream
ctx.BufferResponseBody()    // Buffer instead of stream

// Content detection
ctx.IsWebsocket()           // Check WebSocket upgrade
ctx.IsBinaryRequestBody()   // Check binary content
ctx.IsBinaryResponseBody()  // Check binary content

// Context storage
ctx.SetContext(key, value)
ctx.GetContext(key)
ctx.GetStringContext(key, defaultValue)
ctx.GetBoolContext(key, defaultValue)

// Custom logging
ctx.SetUserAttribute(key, value)
ctx.WriteUserAttributeToLog()

Header/Body Operations (proxywasm)

// Request headers
proxywasm.GetHttpRequestHeader(name)
proxywasm.AddHttpRequestHeader(name, value)
proxywasm.ReplaceHttpRequestHeader(name, value)
proxywasm.RemoveHttpRequestHeader(name)
proxywasm.GetHttpRequestHeaders()
proxywasm.ReplaceHttpRequestHeaders(headers)

// Response headers
proxywasm.GetHttpResponseHeader(name)
proxywasm.AddHttpResponseHeader(name, value)
proxywasm.ReplaceHttpResponseHeader(name, value)
proxywasm.RemoveHttpResponseHeader(name)
proxywasm.GetHttpResponseHeaders()
proxywasm.ReplaceHttpResponseHeaders(headers)

// Request body (only in body phase)
proxywasm.GetHttpRequestBody(start, size)
proxywasm.ReplaceHttpRequestBody(body)
proxywasm.AppendHttpRequestBody(data)
proxywasm.PrependHttpRequestBody(data)

// Response body (only in body phase)
proxywasm.GetHttpResponseBody(start, size)
proxywasm.ReplaceHttpResponseBody(body)
proxywasm.AppendHttpResponseBody(data)
proxywasm.PrependHttpResponseBody(data)

// Direct response
proxywasm.SendHttpResponse(statusCode, headers, body, grpcStatus)

// Flow control
proxywasm.ResumeHttpRequest()   // Resume paused request
proxywasm.ResumeHttpResponse()  // Resume paused response

Common Patterns

External HTTP Call

See references/http-client.md for complete HTTP client patterns.

func parseConfig(json gjson.Result, config *MyConfig) error {
    serviceName := json.Get("serviceName").String()
    servicePort := json.Get("servicePort").Int()
    config.client = wrapper.NewClusterClient(wrapper.FQDNCluster{
        FQDN: serviceName,
        Port: servicePort,
    })
    return nil
}

func onHttpRequestHeaders(ctx wrapper.HttpContext, config MyConfig) types.Action {
    err := config.client.Get("/api/check", nil, func(statusCode int, headers http.Header, body []byte) {
        if statusCode != 200 {
            proxywasm.SendHttpResponse(403, nil, []byte("Forbidden"), -1)
            return
        }
        proxywasm.ResumeHttpRequest()
    }, 3000) // timeout ms
    
    if err != nil {
        return types.HeaderContinue // fallback on error
    }
    return types.HeaderStopAllIterationAndWatermark
}

Redis Integration

See references/redis-client.md for complete Redis patterns.

func parseConfig(json gjson.Result, config *MyConfig) error {
    config.redis = wrapper.NewRedisClusterClient(wrapper.FQDNCluster{
        FQDN: json.Get("redisService").String(),
        Port: json.Get("redisPort").Int(),
    })
    return config.redis.Init(
        json.Get("username").String(),
        json.Get("password").String(),
        json.Get("timeout").Int(),
    )
}

Multi-level Config

插件配置支持在控制台不同级别设置:全局、域名级、路由级。控制面会自动处理配置的优先级和匹配逻辑,插件代码中通过 parseConfig 解析到的就是当前请求匹配到的配置。

Local Testing

See references/local-testing.md for Docker Compose setup.

Advanced Topics

See references/advanced-patterns.md for:

  • Streaming body processing
  • Route call pattern
  • Tick functions (periodic tasks)
  • Leader election
  • Memory management
  • Custom logging

Best Practices

1. Never call Resume after SendHttpResponse - Response auto-resumes 2. Check HasRequestBody() before returning HeaderStopIteration - Avoids blocking 3. Use cached ctx methods - ctx.Path() works in any phase, GetHttpRequestHeader(":path") only in header phase 4. Handle external call failures gracefully - Return HeaderContinue on error to avoid blocking 5. Set appropriate timeouts - Default HTTP call timeout is 500ms

Related skills

FAQ

What language and version does this skill target?

Go 1.24+ using the higress-group wasm-go SDK and proxy-wasm-go-sdk.

Which HTTP phases can a Higress WASM plugin hook into?

Request Headers, Request Body, Response Headers, Response Body, and Stream Done, via ProcessRequestHeaders, ProcessRequestBody, ProcessResponseHeaders, ProcessResponseBody, and ProcessStreamDone.

Backend & APIsbackendintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.