MCPcopy
hub / github.com/serverless/serverless / shouldBypassProxy

Function shouldBypassProxy

packages/sf-core-installer/binary.js:26–48  ·  view source on GitHub ↗
(requestURL)

Source from the content-addressed store, hash-verified

24}
25
26const shouldBypassProxy = (requestURL) => {
27 const noProxy = process.env.NO_PROXY || process.env.no_proxy || ''
28 if (noProxy === '*') return true
29 if (noProxy === '') return false
30
31 const port =
32 requestURL.port || (requestURL.protocol === 'https:' ? '443' : '80')
33 const hostname = formatHostName(requestURL.hostname)
34
35 return noProxy
36 .split(',')
37 .map(parseNoProxyZone)
38 .some((noProxyZone) => {
39 const isMatchedAt = hostname.indexOf(noProxyZone.hostname)
40 const hostnameMatched =
41 isMatchedAt > -1 &&
42 isMatchedAt === hostname.length - noProxyZone.hostname.length
43 if (noProxyZone.hasPort) {
44 return port === noProxyZone.port && hostnameMatched
45 }
46 return hostnameMatched
47 })
48}
49
50const getProxyUrl = (url) => {
51 const requestURL = new URL(url)

Callers 1

getProxyUrlFunction · 0.70

Calls 1

formatHostNameFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…