fix query being duplicated

This commit is contained in:
yusing 2025-02-11 09:44:23 +08:00
parent 07bce90521
commit 040c1f6f78
2 changed files with 6 additions and 4 deletions

View file

@ -60,7 +60,7 @@ var (
var ( var (
HTTPProxyURL = types.MustParseURL(APIBaseURL + EndpointProxyHTTP) HTTPProxyURL = types.MustParseURL(APIBaseURL + EndpointProxyHTTP)
HTTPProxyURLStripLen = len(HTTPProxyURL.Path) HTTPProxyURLStripLen = len(APIEndpointBase + EndpointProxyHTTP)
) )
func IsDockerHostAgent(dockerHost string) bool { func IsDockerHostAgent(dockerHost string) bool {

View file

@ -3,6 +3,7 @@ package handler
import ( import (
"crypto/tls" "crypto/tls"
"net/http" "net/http"
"net/url"
"strconv" "strconv"
"time" "time"
@ -24,8 +25,6 @@ func ProxyHTTP(w http.ResponseWriter, r *http.Request) {
responseHeaderTimeout = 0 responseHeaderTimeout = 0
} }
logging.Debug().Msgf("proxy http request: host=%s, isHTTPs=%t, skipTLSVerify=%t, responseHeaderTimeout=%d", host, isHTTPS, skipTLSVerify, responseHeaderTimeout)
if host == "" { if host == "" {
http.Error(w, "missing required headers", http.StatusBadRequest) http.Error(w, "missing required headers", http.StatusBadRequest)
return return
@ -54,6 +53,9 @@ func ProxyHTTP(w http.ResponseWriter, r *http.Request) {
logging.Debug().Msgf("proxy http request: %s %s", r.Method, r.URL.String()) logging.Debug().Msgf("proxy http request: %s %s", r.Method, r.URL.String())
rp := reverseproxy.NewReverseProxy("agent", types.NewURL(r.URL), transport) rp := reverseproxy.NewReverseProxy("agent", types.NewURL(&url.URL{
Scheme: scheme,
Host: host,
}), transport)
rp.ServeHTTP(w, r) rp.ServeHTTP(w, r)
} }