mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-11-04 01:15:14 +00:00 
			
		
		
		
	Merge pull request #1703 from luoweihua7/develop
fetch cloudflare ipv4/ipv6 fail #1405
This commit is contained in:
		@@ -9,6 +9,9 @@ const CLOUDFRONT_URL   = 'https://ip-ranges.amazonaws.com/ip-ranges.json';
 | 
			
		||||
const CLOUDFARE_V4_URL = 'https://www.cloudflare.com/ips-v4';
 | 
			
		||||
const CLOUDFARE_V6_URL = 'https://www.cloudflare.com/ips-v6';
 | 
			
		||||
 | 
			
		||||
const regIpV4 = /^(\d+\.?){4}\/\d+/;
 | 
			
		||||
const regIpV6 = /^(([\da-fA-F]+)?:)+\/\d+/;
 | 
			
		||||
 | 
			
		||||
const internalIpRanges = {
 | 
			
		||||
 | 
			
		||||
	interval_timeout:    1000 * 60 * 60 * 6, // 6 hours
 | 
			
		||||
@@ -74,14 +77,14 @@ const internalIpRanges = {
 | 
			
		||||
					return internalIpRanges.fetchUrl(CLOUDFARE_V4_URL);
 | 
			
		||||
				})
 | 
			
		||||
				.then((cloudfare_data) => {
 | 
			
		||||
					let items = cloudfare_data.split('\n');
 | 
			
		||||
					let items = cloudfare_data.split('\n').filter((line) => regIpV4.test(line));
 | 
			
		||||
					ip_ranges = [... ip_ranges, ... items];
 | 
			
		||||
				})
 | 
			
		||||
				.then(() => {
 | 
			
		||||
					return internalIpRanges.fetchUrl(CLOUDFARE_V6_URL);
 | 
			
		||||
				})
 | 
			
		||||
				.then((cloudfare_data) => {
 | 
			
		||||
					let items = cloudfare_data.split('\n');
 | 
			
		||||
					let items = cloudfare_data.split('\n').filter((line) => regIpV6.test(line));
 | 
			
		||||
					ip_ranges = [... ip_ranges, ... items];
 | 
			
		||||
				})
 | 
			
		||||
				.then(() => {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user