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 (
HTTPProxyURL = types.MustParseURL(APIBaseURL + EndpointProxyHTTP)
HTTPProxyURLStripLen = len(HTTPProxyURL.Path)
HTTPProxyURLStripLen = len(APIEndpointBase + EndpointProxyHTTP)
)
func IsDockerHostAgent(dockerHost string) bool {

View file

@ -3,6 +3,7 @@ package handler
import (
"crypto/tls"
"net/http"
"net/url"
"strconv"
"time"
@ -24,8 +25,6 @@ func ProxyHTTP(w http.ResponseWriter, r *http.Request) {
responseHeaderTimeout = 0
}
logging.Debug().Msgf("proxy http request: host=%s, isHTTPs=%t, skipTLSVerify=%t, responseHeaderTimeout=%d", host, isHTTPS, skipTLSVerify, responseHeaderTimeout)
if host == "" {
http.Error(w, "missing required headers", http.StatusBadRequest)
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())
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)
}