diff --git a/src/renderer/api/json-api.ts b/src/renderer/api/json-api.ts index ed9d2b221d..df12b08ab7 100644 --- a/src/renderer/api/json-api.ts +++ b/src/renderer/api/json-api.ts @@ -3,7 +3,7 @@ import { stringify } from "querystring"; import { EventEmitter } from "../../common/event-emitter"; import { cancelableFetch } from "../utils/cancelableFetch"; - +import { randomBytes } from "crypto"; export interface JsonApiData { } @@ -55,7 +55,10 @@ export class JsonApi { return this.request(path, params, { ...reqInit, method: "get" }); } - getResponse(reqUrl: string, params?: P, init: RequestInit = { }): Promise { + getResponse(path: string, params?: P, init: RequestInit = {}): Promise { + const reqPath = `${this.config.apiBase}${path}`; + const subdomain = randomBytes(2).toString("hex"); + let reqUrl = `http://${subdomain}.${window.location.host}${reqPath}`; // hack around browser connection limits (chromium allows 6 per domain) const reqInit: RequestInit = { ...init }; const { query } = params || {} as P; @@ -70,8 +73,8 @@ export class JsonApi { } const infoLog: JsonApiLog = { - method: `${reqInit.method.toUpperCase()} (stream)`, - reqUrl, + method: reqInit.method.toUpperCase(), + reqUrl: reqPath, reqInit, }; diff --git a/src/renderer/api/kube-api.ts b/src/renderer/api/kube-api.ts index a193074199..0b3233ae1d 100644 --- a/src/renderer/api/kube-api.ts +++ b/src/renderer/api/kube-api.ts @@ -372,8 +372,7 @@ export class KubeApi { } const { abortController, namespace, callback } = opts; - // FIXME - const watchUrl = `http://${this.kind}-watch.${window.location.host}${apiKubePrefix}${this.getWatchUrl(namespace)}`; + const watchUrl = this.getWatchUrl(namespace); const responsePromise = this.request.getResponse(watchUrl, null, { signal: abortController.signal });