diff --git a/extensions/vscode/src/activation/proxy.ts b/extensions/vscode/src/activation/proxy.ts index 5cae543aa..7b482d435 100644 --- a/extensions/vscode/src/activation/proxy.ts +++ b/extensions/vscode/src/activation/proxy.ts @@ -8,24 +8,18 @@ const app = express(); app.use(cors()); app.use((req, res, next) => { - // Don't proxy the /sw route - if (req.path === "/sw" || req.path === "/service-worker.js") { - return next(); - } - - if (!req.headers["x-continue-url"]) { - // Just let the request through - return next(); - } - // Proxy the request - const { origin, ...headers } = req.headers; + const { origin, host, ...headers } = req.headers; const url = req.headers["x-continue-url"] as string; + const parsedUrl = new URL(url); const protocolString = url.split("://")[0]; const protocol = protocolString === "https" ? https : http; const proxy = protocol.request(url, { method: req.method, - headers: headers, + headers: { + ...headers, + host: parsedUrl.host, + }, }); proxy.on("response", (response) => { @@ -59,29 +53,6 @@ app.use((req, res, next) => { // proxy(req, res, next); // }); -app.get("/sw", (req, res) => { - // Send a script that will register the service worker - res.send( - `
` - ); -}); - -app.get("/service-worker.js", (req, res) => { - // Send the service worker script - res.sendFile("/service-worker.js", { root: __dirname }); -}); - export function startProxy() { app.listen(PROXY_PORT, () => { console.log(`Proxy server is running on port ${PROXY_PORT}`);