So the thing is when i go to an online website ip finder type website and find my website’s IP address and search for it cloudfare says direct ip access not allowed but when using droplet ip does not work. How can I deny all other traffic than what originates from cloudflare in my firewall to make that happen for droplet ip too?

2 comments
  • To elaborate: When I go to websites that find websites IPs like https://ipinfo.info and paste the IP into the browser I get the “ Error 1003 - Direct IP access not allowed” page. However when I go to my DigitalOcean’s droplet’s IP address I see the actual page’s content (example.com) . How would I set it up so for both the IP in the online IP finders and my DigitalOcean’s droplet’s IP both lead to the “ Error 1003 - Direct IP access not allowed” page? Thanks

  • log in to your CloudFlare account and select Firewall from the menu. Then, click IP Firewall. Now, enter an IP address, an IP range, or a two-letter country code you wish to block. Set your rule to either block, whitelist, or challenge, and choose which of your websites to apply this rule to.
    I hope this will help.
    best regards
    Apps4Rent

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

Hi @johnaraon,

How I would approach this is denying access to your website from any other IP addresses directly in your configuration file on your Droplet. Basically, in your WebService (Apache/Nginx) you can deny access from all IP addresses except CloudFlare’s ranges.

If you let me know which WebService you are running, I can provide with some more pointers on how to do so.

Regards,
KFSys

@KFSys is spot on but here is some info.

Sounds like this reference may be what you’re looking for.

https://support.cloudflare.com/hc/en-us/articles/201897700-Allowing-Cloudflare-IP-addresses

https://support.cloudflare.com/hc/en-us/articles/217074967-Configuring-IP-Access-Rules

Those two links will probably give you all you need to know but here is some info about using ufw.

https://www.digitalocean.com/community/tutorials/how-to-setup-a-firewall-with-ufw-on-an-ubuntu-and-debian-cloud-server

This will tell you how to use the deny all and allow from commands to do just what you’re looking for. :)

Also if you have csf instead of ufw here is some info.

https://download.configserver.com/csf/readme.txt

Hope this helps!

by Shaun Lewis
Learn how to setup a firewall with UFW on an Ubuntu / Debian cloud server.
Submit an Answer