1- // eavily inspired by https://github.com/SAP/connect-openui5/blob/master/lib/proxy.js
1+ // heavily inspired by https://github.com/SAP/connect-openui5/blob/master/lib/proxy.js
22const url = require ( "url" ) ;
33const httpProxy = require ( "http-proxy" ) ;
44
@@ -9,14 +9,18 @@ const env = {
99} ;
1010
1111function getProxyUri ( uri ) {
12+ console . log ( "1" , env )
1213 if ( uri . protocol === "https:" && env . httpsProxy || uri . protocol === "http:" && env . httpProxy ) {
13- if ( env . noProxy ) {
14+ console . log ( "2" )
15+ if ( env . noProxy ) { console . log ( "3" )
1416 const canonicalHost = uri . host . replace ( / ^ \. * / , "." ) ;
1517 const port = uri . port || ( uri . protocol === "https:" ? "443" : "80" ) ;
1618
1719 const patterns = env . noProxy . split ( "," ) ;
1820 for ( let i = patterns . length - 1 ; i >= 0 ; i -- ) {
21+ console . log ( "4" )
1922 let pattern = patterns [ i ] . trim ( ) . toLowerCase ( ) ;
23+ console . log ( canonicalHost , pattern )
2024
2125 // don"t use a proxy at all
2226 if ( pattern === "*" ) {
@@ -26,11 +30,7 @@ function getProxyUri(uri) {
2630 // Remove leading * and make sure to have exact one leading dot (.)
2731 pattern = pattern . replace ( / ^ [ * ] + / , "" ) . replace ( / ^ \. * / , "." ) ;
2832
29- // add port if no specified
30- if ( pattern . indexOf ( ":" ) === - 1 ) {
31- pattern += ":" + port ;
32- }
33-
33+ console . log ( canonicalHost , pattern )
3434 // if host ends with pattern, no proxy should be used
3535 if ( canonicalHost . indexOf ( pattern ) === canonicalHost . length - pattern . length ) {
3636 return null ;
0 commit comments