@@ -8,12 +8,12 @@ import { Router as WsRouter } from "../wsRouter"
88
99export const router = Router ( )
1010
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 } `
1514 }
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 } ` : "" } `
1717}
1818
1919router . all ( "/(:port)(/*)?" , ( req , res ) => {
@@ -33,7 +33,7 @@ router.all("/(:port)(/*)?", (req, res) => {
3333
3434 proxy . web ( req , res , {
3535 ignorePath : true ,
36- target : getProxyTarget ( req , true ) ,
36+ target : getProxyTarget ( req , req . args [ "proxy-path-passthrough" ] || false ) ,
3737 } )
3838} )
3939
@@ -42,6 +42,6 @@ export const wsRouter = WsRouter()
4242wsRouter . ws ( "/(:port)(/*)?" , ensureAuthenticated , ( req ) => {
4343 proxy . ws ( req , req . ws , req . head , {
4444 ignorePath : true ,
45- target : getProxyTarget ( req , true ) ,
45+ target : getProxyTarget ( req , req . args [ "proxy-path-passthrough" ] || false ) ,
4646 } )
4747} )
0 commit comments