File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,38 +18,14 @@ const proxyOptionPathsAsProperties = [
1818 target : `http://localhost:${ port1 } ` ,
1919 } ,
2020 {
21- context : "/api/proxy2" ,
21+ path : "/api/proxy2" ,
2222 target : `http://localhost:${ port2 } ` ,
2323 pathRewrite : { "^/api" : "" } ,
2424 } ,
2525 {
26- context : "/foo" ,
27- bypass ( req ) {
28- if ( / \. h t m l $ / . test ( req . path || req . url ) ) {
29- return "/index.html" ;
30- }
31-
32- return null ;
33- } ,
34- } ,
35- {
36- context : "proxyfalse" ,
37- bypass ( req ) {
38- if ( / \/ p r o x y f a l s e $ / . test ( req . path || req . url ) ) {
39- return false ;
40- }
41- } ,
42- } ,
43- {
44- context : "/bypass-with-target" ,
26+ pathFilter : "**/*.html" ,
4527 target : `http://localhost:${ port1 } ` ,
46- changeOrigin : true ,
47- secure : false ,
48- bypass ( req ) {
49- if ( / \. ( h t m l ) $ / i. test ( req . path || req . url ) ) {
50- return req . url ;
51- }
52- } ,
28+ pathRewrite : ( ) => "/index.html" ,
5329 } ,
5430] ;
5531
@@ -140,6 +116,9 @@ describe("proxy option", () => {
140116 proxyApp1 . get ( "/api" , ( req , res ) => {
141117 res . send ( "api response from proxy1" ) ;
142118 } ) ;
119+ proxyApp1 . get ( "/index.html" , ( req , res ) => {
120+ res . send ( "Hello" ) ;
121+ } ) ;
143122 proxyApp2 . get ( "/proxy2" , ( req , res ) => {
144123 res . send ( "from proxy2" ) ;
145124 } ) ;
You can’t perform that action at this time.
0 commit comments