mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 20:52:33 +02:00
fix query being duplicated
This commit is contained in:
parent
07bce90521
commit
040c1f6f78
2 changed files with 6 additions and 4 deletions
|
@ -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 {
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue