mirror of
https://git.tuxpa.in/a/code-server.git
synced 2024-12-26 12:15:26 +00:00
routes/index.ts: register proxy routes before body-parser
Any json or urlencoded request bodies were being consumed by body-parser before they could be proxied. That's why requests without Content-Type were proxied correctly as body-parser would not consume their body. This allows the http-proxy package to passthrough the request body correctly in all instances. Closes #2377
This commit is contained in:
parent
f5cf3fd331
commit
58d72d53a1
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user