@@ -8,12 +8,12 @@ import { Router as WsRouter } from "../wsRouter"
8
8
9
9
export const router = Router ( )
10
10
11
- const getProxyTarget = ( req : Request , rewrite : boolean ) : string => {
12
- if ( rewrite ) {
13
- const query = qs . stringify ( req . query )
14
- return `http://0.0.0.0:${ req . params . port } /${ req . params [ 0 ] || "" } ${ query ? `?${ query } ` : "" } `
11
+ const getProxyTarget = ( req : Request , passthroughPath : boolean ) : string => {
12
+ if ( passthroughPath ) {
13
+ return `http://0.0.0.0:${ req . params . port } /${ req . originalUrl } `
15
14
}
16
- return `http://0.0.0.0:${ req . params . port } /${ req . originalUrl } `
15
+ const query = qs . stringify ( req . query )
16
+ return `http://0.0.0.0:${ req . params . port } /${ req . params [ 0 ] || "" } ${ query ? `?${ query } ` : "" } `
17
17
}
18
18
19
19
router . all ( "/(:port)(/*)?" , ( req , res ) => {
@@ -33,7 +33,7 @@ router.all("/(:port)(/*)?", (req, res) => {
33
33
34
34
proxy . web ( req , res , {
35
35
ignorePath : true ,
36
- target : getProxyTarget ( req , true ) ,
36
+ target : getProxyTarget ( req , req . args [ "proxy-path-passthrough" ] || false ) ,
37
37
} )
38
38
} )
39
39
@@ -42,6 +42,6 @@ export const wsRouter = WsRouter()
42
42
wsRouter . ws ( "/(:port)(/*)?" , ensureAuthenticated , ( req ) => {
43
43
proxy . ws ( req , req . ws , req . head , {
44
44
ignorePath : true ,
45
- target : getProxyTarget ( req , true ) ,
45
+ target : getProxyTarget ( req , req . args [ "proxy-path-passthrough" ] || false ) ,
46
46
} )
47
47
} )
0 commit comments