From c8edab3fd5ce7a7d508893fbd73746de2d434233 Mon Sep 17 00:00:00 2001 From: pangshaoqiang Date: Thu, 21 Apr 2022 16:29:09 +0800 Subject: [PATCH] Fix pod exec through cluster/proxy Signed-off-by: pangshaoqiang --- pkg/registry/cluster/storage/proxy.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/registry/cluster/storage/proxy.go b/pkg/registry/cluster/storage/proxy.go index d0a21b2b5..ea0bdb5ba 100644 --- a/pkg/registry/cluster/storage/proxy.go +++ b/pkg/registry/cluster/storage/proxy.go @@ -109,6 +109,10 @@ func newProxyHandler(location *url.URL, transport http.RoundTripper, impersonate req.Header.Set("Authorization", fmt.Sprintf("bearer %s", impersonateToken)) + // Retain RawQuery in location because upgrading the request will use it. + // See https://github.com/karmada-io/karmada/issues/1618#issuecomment-1103793290 for more info. + location.RawQuery = req.URL.RawQuery + handler := newThrottledUpgradeAwareProxyHandler(location, transport, true, false, responder) handler.ServeHTTP(rw, req) }), nil