Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(platform): trim prefix in not found proxy #1696

Merged
merged 1 commit into from
Dec 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(platform): trim prefix in not found proxy
  • Loading branch information
leonarliu committed Dec 3, 2021
commit 215963f2dabde6e83fa16e444a68c09187984f41
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"net/http"
"net/http/httputil"
"net/url"
"strings"
"time"

apierrors "k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -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{
Expand Down