Algorithms, Blockchain and Cloud

How to Whitelist The CloudFlare IPs?


You probably need to whitelist the cloudflare IPs in order to enable their ‘Always-Online’ feature. The CloudFlare IPs can be found in this list: https://www.cloudflare.com/ips/

he IP addresses listed on that page are actually subnets, which are made up of blocks of IPs. For example 103.21.244.0/22 consists of 1022 IP addresses as follows:

Address:   103.21.244.0         01100111.00010101.111101 00.00000000
Netmask:   255.255.252.0 = 22   11111111.11111111.111111 00.00000000
Wildcard:  0.0.3.255            00000000.00000000.000000 11.11111111
=>
Network:   103.21.244.0/22      01100111.00010101.111101 00.00000000
HostMin:   103.21.244.1         01100111.00010101.111101 00.00000001
HostMax:   103.21.247.254       01100111.00010101.111101 11.11111110
Broadcast: 103.21.247.255       01100111.00010101.111101 11.11111111
Hosts/Net: 1022                  Class A

You can use the command ipcalc to analyse these IP ranges.

Whitelist in .htaccess

You just make sure that these IPs are not banned in the .htaccess or the apache2 configuration settings. Normally, if you ban a IP, it will look like this in .htaccess:

allow from all
#Quick ban IP. Will be updated on next formal rules save.
SetEnvIF REMOTE_ADDR "^92\.84\.202\.43$" DenyAccess
SetEnvIF X-FORWARDED-FOR "^92\.84\.202\.43$" DenyAccess
SetEnvIF X-CLUSTER-CLIENT-IP "^92\.84\.202\.43$" DenyAccess
order allow,deny
deny from env=DenyAccess
deny from 92.84.202.43

In /etc/apache2/apache2.conf, you sometimes can ban particular IPs.

<Location />
<Limit GET POST PUT>
  order allow,deny
  allow from all
  deny from 72.220.127.178
</Limit>
</Location>

I do not enable Always-Online, do I still have to whitelist the cloudflare IPs?

Answer: Yes, you would still need to whitelist our IPs, Cloudflare is operating as a reverse proxy, so all connections that come through Cloudflare to your origin, come from our IPs.

If you are not whitelisting our IPs there is a possibility your hosting provider or your server security software will rate-limit or block our connections, and you may experience 522 response codes.

–EOF (The Ultimate Computing & Technology Blog) —

329 words
Last Post: What are the user-agent for Cloudflare?
Next Post: Dynamic Programming - How many ways to connect the pipes?

The Permanent URL is: How to Whitelist The CloudFlare IPs? (AMP Version)

Exit mobile version