-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathnginx-cloudflare.conf
51 lines (45 loc) · 1.65 KB
/
nginx-cloudflare.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#
# Author: Hari Sekhon
# Date: 2022-07-25 14:02:12 +0100 (Mon, 25 Jul 2022)
#
# vim:ts=2:sts=2:sw=2:et
#
# https://github.com/HariSekhon/Templates
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/HariSekhon
#
# ============================================================================ #
# N g i n x C l o u d f l a r e
# ============================================================================ #
# Cloudflare Proxy Mode IP Source Ranges
# Get up to date IP ranges from Cloudflare API using script from my DevOps-Bash-tools repo:
#
# cloudflare_ip_ranges.sh | sort | sed 's/^/set_real_ip_from /; s/$/;/' >> nginx-cloudflare.conf
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 104.16.0.0/13;
set_real_ip_from 104.24.0.0/14;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 131.0.72.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 2400:cb00::/32;
set_real_ip_from 2405:8100::/32;
set_real_ip_from 2405:b500::/32;
set_real_ip_from 2606:4700::/32;
set_real_ip_from 2803:f800::/32;
set_real_ip_from 2a06:98c0::/29;
set_real_ip_from 2c0f:f248::/32;
# Cloudflare's version of X-Forwarded-For header to extract
real_ip_header CF-Connecting-IP;