From 1f828b47040bb143d5e84ba1aeaf0cce06150600 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Wed, 20 Jan 2021 17:32:47 -0500 Subject: [PATCH] routes/index.ts: use bodyParser after registering proxies This allows the http-proxy package to passthrough the request body correctly. Closes #2377 --- src/node/routes/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/node/routes/index.ts b/src/node/routes/index.ts index 00654367965d..a3fb8bd4f518 100644 --- a/src/node/routes/index.ts +++ b/src/node/routes/index.ts @@ -65,9 +65,6 @@ export const register = async ( app.use(cookieParser()) wsApp.use(cookieParser()) - app.use(bodyParser.json()) - app.use(bodyParser.urlencoded({ extended: true })) - const common: express.RequestHandler = (req, _, next) => { // /healthz|/healthz/ needs to be excluded otherwise health checks will make // it look like code-server is always in use. @@ -106,6 +103,12 @@ export const register = async ( app.use("/", domainProxy.router) wsApp.use("/", domainProxy.wsRouter.router) + app.use("/proxy", proxy.router) + wsApp.use("/proxy", proxy.wsRouter.router) + + app.use(bodyParser.json()) + app.use(bodyParser.urlencoded({ extended: true })) + app.use("/", vscode.router) wsApp.use("/", vscode.wsRouter.router) app.use("/vscode", vscode.router) @@ -121,9 +124,6 @@ export const register = async ( }) } - app.use("/proxy", proxy.router) - wsApp.use("/proxy", proxy.wsRouter.router) - app.use("/static", _static.router) app.use("/update", update.router)