From 61cd3e4b5be69d9aad37cdb1f314751379d29b2f Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Mon, 28 Feb 2022 09:58:55 +0200 Subject: [PATCH] fix bug in context handler Signed-off-by: Jari Kolehmainen --- src/main/context-handler/context-handler.ts | 2 +- src/main/kube-auth-proxy/kube-auth-proxy.ts | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/context-handler/context-handler.ts b/src/main/context-handler/context-handler.ts index 5287828b5b..ad1ba734b8 100644 --- a/src/main/context-handler/context-handler.ts +++ b/src/main/context-handler/context-handler.ts @@ -118,7 +118,7 @@ export class ContextHandler { await this.ensureServer(); const path = this.clusterUrl.path !== "/" ? this.clusterUrl.path : ""; - return `http://127.0.0.1:${this.kubeAuthProxy.port}${this.kubeAuthProxy.apiPrefix}${path}`; + return `http://127.0.0.1:${this.kubeAuthProxy.port}${this.kubeAuthProxy.apiPrefix.slice(0, -1)}${path}`; } async getApiTarget(isLongRunningRequest = false): Promise { diff --git a/src/main/kube-auth-proxy/kube-auth-proxy.ts b/src/main/kube-auth-proxy/kube-auth-proxy.ts index bc9fc53baf..5bd5963a5d 100644 --- a/src/main/kube-auth-proxy/kube-auth-proxy.ts +++ b/src/main/kube-auth-proxy/kube-auth-proxy.ts @@ -8,7 +8,6 @@ import { waitUntilUsed } from "tcp-port-used"; import { randomBytes } from "crypto"; import type { Cluster } from "../../common/cluster/cluster"; import logger from "../logger"; -import * as url from "url"; import { getPortFrom } from "../utils/get-port"; import { makeObservable, observable, when } from "mobx"; @@ -27,13 +26,10 @@ export class KubeAuthProxy { protected _port: number; protected proxyProcess?: ChildProcess; - protected readonly acceptHosts: string; @observable protected ready = false; constructor(private dependencies: Dependencies, protected readonly cluster: Cluster, protected readonly env: NodeJS.ProcessEnv) { makeObservable(this); - - this.acceptHosts = url.parse(this.cluster.apiUrl).hostname; } get whenReady() {