File tree 1 file changed +21
-11
lines changed
1 file changed +21
-11
lines changed Original file line number Diff line number Diff line change 1
- const filter = function ( pathname , req ) {
2
- return req . method === 'GET' && pathname . match ( '^/(index\.html)?$' )
3
- } ;
4
-
5
1
const LOCAL_IP = '127.0.0.1' ;
6
2
3
+ const backend = [
4
+ "/api" ,
5
+ "/storages"
6
+ ] ;
7
+
7
8
const PROXY_CONFIG = [
8
9
{
9
- context : filter ,
10
+ // don't forward when path matches /static/assets or backend endpoints to prevent infinity loop.
11
+ context : function ( pathname ) {
12
+ const ignored = [ "/static/assets" , ...backend ] . join ( "|" ) . replace ( / \/ / g, "\\/" ) ;
13
+ const matchesIgnored = new RegExp ( `^${ ignored } ` ) . test ( pathname ) ;
14
+ return matchesIgnored === false ;
15
+ } ,
10
16
target : `http://${ LOCAL_IP } :4200/static/assets` ,
11
17
secure : false ,
12
- logLevel : "debug "
18
+ logLevel : "info "
13
19
} ,
14
20
{
15
- context : [
16
- "/api" ,
17
- "/storages"
18
- ] ,
21
+ context : backend ,
19
22
target : `http://${ LOCAL_IP } :48080` ,
20
23
secure : false ,
21
- logLevel : "debug " ,
24
+ logLevel : "info " ,
22
25
changeOrigin : true
23
26
}
24
27
] ;
25
28
29
+ console . log ( ) ;
30
+ console . log ( '\x1b[35m%s\x1b[0m' , 'Note: You need to have a running Strongbox instance for the UI to work!' ) ;
31
+ console . log ( "https://strongbox.github.io/developer-guide/building-strongbox-using-strongbox-instance.html#starting-a-strongbox-instance" ) ;
32
+ console . log ( ) ;
33
+ console . log ( ) ;
34
+ console . log ( ) ;
35
+
26
36
module . exports = PROXY_CONFIG ;
You can’t perform that action at this time.
0 commit comments