-
Notifications
You must be signed in to change notification settings - Fork 566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: 🐛 frontend-grayurl 解析不正确导致路由失败 #1550
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1550 +/- ##
==========================================
+ Coverage 35.91% 43.52% +7.61%
==========================================
Files 69 76 +7
Lines 11576 12325 +749
==========================================
+ Hits 4157 5364 +1207
+ Misses 7104 6626 -478
- Partials 315 335 +20 |
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果有错误的话,是不是应该记录个日志以便排查?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果有错误的话,是不是应该记录个日志以便排查?
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是不是把解析失败的path也打出来?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是不是把解析失败的path也打出来?
好的,已经修改
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是不是把解析失败的path也打出来?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
fix: 修复 url 解析不正确导致路由失败
refer: #1548