From 215963f2dabde6e83fa16e444a68c09187984f41 Mon Sep 17 00:00:00 2001 From: leonarliu Date: Fri, 3 Dec 2021 15:57:16 +0800 Subject: [PATCH] fix(platform): trim prefix in not found proxy --- pkg/platform/registry/cluster/storage/customresource_proxy.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/platform/registry/cluster/storage/customresource_proxy.go b/pkg/platform/registry/cluster/storage/customresource_proxy.go index e1d6e6ad4..d2019070f 100644 --- a/pkg/platform/registry/cluster/storage/customresource_proxy.go +++ b/pkg/platform/registry/cluster/storage/customresource_proxy.go @@ -25,6 +25,7 @@ import ( "net/http" "net/http/httputil" "net/url" + "strings" "time" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -123,7 +124,8 @@ func (n *CustomResourceHandler) ServeHTTP(w http.ResponseWriter, r *http.Request reserveProxy := httputil.NewSingleHostReverseProxy(&url.URL{ Scheme: "https", - Host: config.Host, + // TODO: support apiserver with path + Host: strings.TrimPrefix(config.Host, "https://"), }) reserveProxy.Transport = &http.Transport{ DialContext: (&net.Dialer{