mirror of
https://github.com/lensapp/lens.git
synced 2024-09-21 06:17:36 +03: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}?`)) {
|
||||
this.handleWsUpgrade(req, socket, head)
|
||||
} else {
|
||||
if (req.headers.upgrade?.startsWith("SPDY")) {
|
||||
this.handleSpdyProxy(proxy, req, socket, head)
|
||||
} else {
|
||||
socket.end()
|
||||
}
|
||||
this.handleProxyUpgrade(proxy, req, socket, head)
|
||||
}
|
||||
})
|
||||
spdyProxy.on("error", (err) => {
|
||||
@ -66,7 +62,7 @@ export class LensProxy {
|
||||
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)
|
||||
if (cluster) {
|
||||
const proxyUrl = await cluster.contextHandler.resolveAuthProxyUrl() + req.url.replace(apiKubePrefix, "")
|
||||
|
Loading…
Reference in New Issue
Block a user