(codeServer: CodeServerPage | CodeServer)
| 114 | * Otherwise, return the direct address of code-server. |
| 115 | */ |
| 116 | export async function getMaybeProxiedCodeServer(codeServer: CodeServerPage | CodeServer): Promise<string> { |
| 117 | const address = await codeServer.address() |
| 118 | if (process.env.USE_PROXY === "1") { |
| 119 | const uri = new URL(address) |
| 120 | return `http://${uri.hostname}:${REVERSE_PROXY_PORT}/${uri.port}/${REVERSE_PROXY_BASE_PATH}/` |
| 121 | } |
| 122 | |
| 123 | return address |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Stripes proxy base from url.pathname |