From 6a93ef568c308da28849feb730bc70e0b80a8d52 Mon Sep 17 00:00:00 2001 From: heimanba <371510756@qq.com> Date: Thu, 28 Nov 2024 15:29:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20frontend-gray=20=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2url=E8=A7=A3=E6=9E=90=E4=B8=8D=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E8=B7=AF=E7=94=B1=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/wasm-go/extensions/frontend-gray/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/wasm-go/extensions/frontend-gray/main.go b/plugins/wasm-go/extensions/frontend-gray/main.go index 2cb4a5f9fe..50c569ef30 100644 --- a/plugins/wasm-go/extensions/frontend-gray/main.go +++ b/plugins/wasm-go/extensions/frontend-gray/main.go @@ -3,6 +3,7 @@ package main import ( "fmt" "net/http" + "net/url" "path" "strings" @@ -35,6 +36,10 @@ func parseConfig(json gjson.Result, grayConfig *config.GrayConfig, log wrapper.L func onHttpRequestHeaders(ctx wrapper.HttpContext, grayConfig config.GrayConfig, log wrapper.Log) types.Action { requestPath, _ := proxywasm.GetHttpRequestHeader(":path") requestPath = path.Clean(requestPath) + parsedURL, err := url.Parse(requestPath) + if err == nil { + requestPath = parsedURL.Path + } enabledGray := util.IsGrayEnabled(grayConfig, requestPath) ctx.SetContext(config.EnabledGray, enabledGray)