| 85 | ]; |
| 86 | |
| 87 | function shouldIgnoreCors(url: URL) { |
| 88 | if (__TEST__) { |
| 89 | return false; |
| 90 | } |
| 91 | const {host, hostname, port, protocol} = url; |
| 92 | if (!corsHosts.has(host)) { |
| 93 | corsHosts.add(host); |
| 94 | } |
| 95 | if (checkedHosts.has(host)) { |
| 96 | return false; |
| 97 | } |
| 98 | if ( |
| 99 | corsHosts.size >= MAX_CORS_HOSTS || |
| 100 | protocol !== 'https:' || |
| 101 | port !== '' || |
| 102 | localAliases.includes(hostname) || |
| 103 | localSubDomains.some((sub) => hostname.endsWith(sub)) || |
| 104 | hostname.startsWith('[') || |
| 105 | hostname.match(ipV4RegExp) |
| 106 | ) { |
| 107 | return true; |
| 108 | } |
| 109 | checkedHosts.add(host); |
| 110 | return false; |
| 111 | } |