File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export class ProxyHttpProvider extends HttpProvider {
2424 const port = route . base . replace ( / ^ \/ / , "" )
2525 return {
2626 proxy : {
27- base : `${ route . providerBase } /${ port } ` ,
27+ strip : `${ route . providerBase } /${ port } ` ,
2828 port,
2929 } ,
3030 }
@@ -35,7 +35,7 @@ export class ProxyHttpProvider extends HttpProvider {
3535 const port = route . base . replace ( / ^ \/ / , "" )
3636 return {
3737 proxy : {
38- base : `${ route . providerBase } /${ port } ` ,
38+ strip : `${ route . providerBase } /${ port } ` ,
3939 port,
4040 } ,
4141 }
Original file line number Diff line number Diff line change @@ -36,9 +36,13 @@ export type Query = { [key: string]: string | string[] | undefined }
3636
3737export interface ProxyOptions {
3838 /**
39- * A base path to strip from from the request before proxying if necessary.
39+ * A path to strip from from the beginning of the request before proxying
4040 */
41- base ?: string
41+ strip ?: string
42+ /**
43+ * A path to add to the beginning of the request before proxying.
44+ */
45+ prepend ?: string
4246 /**
4347 * The port to proxy.
4448 */
@@ -826,10 +830,11 @@ export class HttpServer {
826830 // sure how best to get this information to the `proxyRes` event handler.
827831 // For now I'm sticking it on the request object which is passed through to
828832 // the event.
829- ; ( request as ProxyRequest ) . base = options . base
833+ ; ( request as ProxyRequest ) . base = options . strip
830834
831835 const isHttp = response instanceof http . ServerResponse
832- const path = options . base ? route . fullPath . replace ( options . base , "" ) : route . fullPath
836+ const base = options . strip ? route . fullPath . replace ( options . strip , "" ) : route . fullPath
837+ const path = normalize ( "/" + ( options . prepend || "" ) + "/" + base , true )
833838 const proxyOptions : proxy . ServerOptions = {
834839 changeOrigin : true ,
835840 ignorePath : true ,
You can’t perform that action at this time.
0 commit comments