Commit c039b317 authored by qiuqunfeng's avatar qiuqunfeng
Browse files

Enhance WafLogController proxy handling by setting request URL scheme and...

Enhance WafLogController proxy handling by setting request URL scheme and preserving query parameters, improving request integrity for WAF log processing.
parent dcea33ad
...@@ -37,6 +37,8 @@ func (c *WafLogController) WafLogProxy(ctx *gin.Context) { ...@@ -37,6 +37,8 @@ func (c *WafLogController) WafLogProxy(ctx *gin.Context) {
// } // }
proxy := &httputil.ReverseProxy{ proxy := &httputil.ReverseProxy{
Rewrite: func(req *httputil.ProxyRequest) { Rewrite: func(req *httputil.ProxyRequest) {
req.Out.URL.Scheme = remoteUrl.Scheme
req.Out.URL.RawQuery = req.In.URL.RawQuery
req.Out.URL.Host = remoteUrl.Host req.Out.URL.Host = remoteUrl.Host
req.Out.URL.Path = strings.Replace(req.In.URL.Path, "/api/v2/containerSec/waf", "/api/v2/waf", 1) req.Out.URL.Path = strings.Replace(req.In.URL.Path, "/api/v2/containerSec/waf", "/api/v2/waf", 1)
}, },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment