Skip to content

Commit f589348

Browse files
committed
Make path proxy async
1 parent 5b2c7a6 commit f589348

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/node/routes/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,17 @@ export const register = async (app: App, args: DefaultedArgs): Promise<Disposabl
9494
app.router.use("/", domainProxy.router)
9595
app.wsRouter.use("/", domainProxy.wsRouter.router)
9696

97-
app.router.all("/proxy/(:port)(/*)?", (req, res) => {
98-
pathProxy.proxy(req, res)
97+
app.router.all("/proxy/(:port)(/*)?", async (req, res) => {
98+
await pathProxy.proxy(req, res)
9999
})
100100
app.wsRouter.get("/proxy/(:port)(/*)?", async (req) => {
101101
await pathProxy.wsProxy(req as pluginapi.WebsocketRequest)
102102
})
103103
// These two routes pass through the path directly.
104104
// So the proxied app must be aware it is running
105105
// under /absproxy/<someport>/
106-
app.router.all("/absproxy/(:port)(/*)?", (req, res) => {
107-
pathProxy.proxy(req, res, {
106+
app.router.all("/absproxy/(:port)(/*)?", async (req, res) => {
107+
await pathProxy.proxy(req, res, {
108108
passthroughPath: true,
109109
})
110110
})

src/node/routes/pathProxy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export async function proxy(
2020
opts?: {
2121
passthroughPath?: boolean
2222
},
23-
): void {
23+
): Promise<void> {
2424
if (!(await authenticated(req))) {
2525
// If visiting the root (/:port only) redirect to the login page.
2626
if (!req.params[0] || req.params[0] === "/") {

0 commit comments

Comments
 (0)