MCPcopy Index your code
hub / github.com/coder/code-server / wsProxy

Function wsProxy

src/node/routes/pathProxy.ts:58–78  ·  view source on GitHub ↗
(
  req: WebsocketRequest,
  opts?: {
    passthroughPath?: boolean
    proxyBasePath?: string
  },
)

Source from the content-addressed store, hash-verified

56}
57
58export async function wsProxy(
59 req: WebsocketRequest,
60 opts?: {
61 passthroughPath?: boolean
62 proxyBasePath?: string
63 },
64): Promise<void> {
65 ensureProxyEnabled(req)
66 ensureOrigin(req)
67 await ensureAuthenticated(req)
68
69 // The base is used for rewriting (redirects, target).
70 if (!opts?.passthroughPath) {
71 ;(req as any).base = req.path.split(path.sep).slice(0, 3).join(path.sep)
72 }
73
74 _proxy.ws(req, req.ws, req.head, {
75 ignorePath: true,
76 target: getProxyTarget(req, opts),
77 })
78}

Callers

nothing calls this directly

Calls 5

ensureProxyEnabledFunction · 0.90
ensureOriginFunction · 0.90
ensureAuthenticatedFunction · 0.90
getProxyTargetFunction · 0.85
wsMethod · 0.45

Tested by

no test coverage detected