mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
cleanup proxy upgrade handler (#963)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
5401c99298
commit
51b21347da
@ -53,11 +53,7 @@ export class LensProxy {
|
|||||||
if (req.url.startsWith(`${apiPrefix}?`)) {
|
if (req.url.startsWith(`${apiPrefix}?`)) {
|
||||||
this.handleWsUpgrade(req, socket, head)
|
this.handleWsUpgrade(req, socket, head)
|
||||||
} else {
|
} else {
|
||||||
if (req.headers.upgrade?.startsWith("SPDY")) {
|
this.handleProxyUpgrade(proxy, req, socket, head)
|
||||||
this.handleSpdyProxy(proxy, req, socket, head)
|
|
||||||
} else {
|
|
||||||
socket.end()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
spdyProxy.on("error", (err) => {
|
spdyProxy.on("error", (err) => {
|
||||||
@ -66,7 +62,7 @@ export class LensProxy {
|
|||||||
return spdyProxy
|
return spdyProxy
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async handleSpdyProxy(proxy: httpProxy, req: http.IncomingMessage, socket: net.Socket, head: Buffer) {
|
protected async handleProxyUpgrade(proxy: httpProxy, req: http.IncomingMessage, socket: net.Socket, head: Buffer) {
|
||||||
const cluster = this.clusterManager.getClusterForRequest(req)
|
const cluster = this.clusterManager.getClusterForRequest(req)
|
||||||
if (cluster) {
|
if (cluster) {
|
||||||
const proxyUrl = await cluster.contextHandler.resolveAuthProxyUrl() + req.url.replace(apiKubePrefix, "")
|
const proxyUrl = await cluster.contextHandler.resolveAuthProxyUrl() + req.url.replace(apiKubePrefix, "")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user