How do I whitelist CloudFlare's IPs in .htaccess?

You would put these commands in .htacess to whitelist CloudFlare's IP addresses:

(IPv4)

Allow from 199.27.128.0/21
Allow from 173.245.48.0/20
Allow from 103.21.244.0/22
Allow from 103.22.200.0/22
Allow from 103.31.4.0/22
Allow from 141.101.64.0/18
Allow from 108.162.192.0/18
Allow from 190.93.240.0/20
Allow from 188.114.96.0/20
Allow from 197.234.240.0/22
Allow from 198.41.128.0/17
Allow from 162.158.0.0/15
Allow from 104.16.0.0/12

(IPv6)

Allow from 2400:cb00::/32
Allow from 2606:4700::/32
Allow from 2803:f800::/32
Allow from 2405:b500::/32
Allow from 2405:8100::/32

Please note: These ips should also be whitlelisted in /etc/csf.allow and /etc/csf.ignore.

Have more questions? Submit a request

Comments

Article is closed for comments.