Skip to content

Commit

Permalink
fix: 🐛 frontend-gray 页面url解析不正确导致路由失败
Browse files Browse the repository at this point in the history
  • Loading branch information
heimanba committed Nov 28, 2024
1 parent ca7458c commit 6a93ef5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plugins/wasm-go/extensions/frontend-gray/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
"net/http"
"net/url"
"path"
"strings"

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 6a93ef5

Please sign in to comment.