fix(agent): incorrect uri in reverse proxy

This commit is contained in:
yusing
2025-09-17 14:03:35 +08:00
parent 7205bf47de
commit ca805edfe0

View File

@@ -19,7 +19,6 @@ func (cfg *AgentConfig) Do(ctx context.Context, method, endpoint string, body io
}
func (cfg *AgentConfig) Forward(req *http.Request, endpoint string) (*http.Response, error) {
req = req.WithContext(req.Context())
req.URL.Host = AgentHost
req.URL.Scheme = "https"
req.URL.Path = APIEndpointBase + endpoint
@@ -58,7 +57,7 @@ func (cfg *AgentConfig) Websocket(ctx context.Context, endpoint string) (*websoc
// If the request has a query, it will be added to the proxy request's URL
func (cfg *AgentConfig) ReverseProxy(w http.ResponseWriter, req *http.Request, endpoint string) error {
rp := reverseproxy.NewReverseProxy("agent", nettypes.NewURL(AgentURL), cfg.Transport())
uri := APIEndpointBase + endpoint
uri := endpoint
if req.URL.RawQuery != "" {
uri += "?" + req.URL.RawQuery
}