File tree Expand file tree Collapse file tree 2 files changed +50
-20
lines changed Expand file tree Collapse file tree 2 files changed +50
-20
lines changed Original file line number Diff line number Diff line change @@ -1769,6 +1769,10 @@ function checkBypass(reqUrl) {
1769
1769
if ( ! reqUrl . hostname ) {
1770
1770
return false ;
1771
1771
}
1772
+ const reqHost = reqUrl . hostname ;
1773
+ if ( isLoopbackAddress ( reqHost ) ) {
1774
+ return true ;
1775
+ }
1772
1776
const noProxy = process . env [ 'no_proxy' ] || process . env [ 'NO_PROXY' ] || '' ;
1773
1777
if ( ! noProxy ) {
1774
1778
return false ;
@@ -1794,13 +1798,24 @@ function checkBypass(reqUrl) {
1794
1798
. split ( ',' )
1795
1799
. map ( x => x . trim ( ) . toUpperCase ( ) )
1796
1800
. filter ( x => x ) ) {
1797
- if ( upperReqHosts . some ( x => x === upperNoProxyItem ) ) {
1801
+ if ( upperNoProxyItem === '*' ||
1802
+ upperReqHosts . some ( x => x === upperNoProxyItem ||
1803
+ x . endsWith ( `.${ upperNoProxyItem } ` ) ||
1804
+ ( upperNoProxyItem . startsWith ( '.' ) &&
1805
+ x . endsWith ( `${ upperNoProxyItem } ` ) ) ) ) {
1798
1806
return true ;
1799
1807
}
1800
1808
}
1801
1809
return false ;
1802
1810
}
1803
1811
exports . checkBypass = checkBypass ;
1812
+ function isLoopbackAddress ( host ) {
1813
+ const hostLower = host . toLowerCase ( ) ;
1814
+ return ( hostLower === 'localhost' ||
1815
+ hostLower . startsWith ( '127.' ) ||
1816
+ hostLower . startsWith ( '[::1]' ) ||
1817
+ hostLower . startsWith ( '[0:0:0:0:0:0:0:1]' ) ) ;
1818
+ }
1804
1819
//# sourceMappingURL=proxy.js.map
1805
1820
1806
1821
/***/ } ) ,
You can’t perform that action at this time.
0 commit comments