Skip to content

Commit

Permalink
routes/index.ts: use bodyParser after registering proxies
Browse files Browse the repository at this point in the history
This allows the http-proxy package to passthrough the request body
correctly. Closes coder#2377
  • Loading branch information
nhooyr committed Jan 20, 2021
1 parent e5d0b49 commit 1f828b4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/node/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand All @@ -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)

Expand Down

0 comments on commit 1f828b4

Please sign in to comment.