Hi, am using Ubuntu 20.04 and I have Litespeed Web Server installed on it. Please is there a way to only allow access to my server through Cloudflare IPs?
Currently am able to access my server with
myIp:8090. Is there a way to block direct access to my server IP? I only want to allow access to my website through Cloudflare.
You are going to want to your Authenticated Origin Pulls. This means that Cloudflare will send a certificate when it tries to connect to your server.
The other way is just to firewall off all IPs from that port expect for Cloudflare’s IPs
Please note that if you have something running on port 8090, and you actually want to access it yourself, if you block non-Cloudflare IPs from it you won’t be able to access it at all as Cloudflare does not proxy that port. Port 8080 is supported, so you probably want to move whatever service that is to 8080.
What I want is to block all access to my server. I don’t want hackers to access my IP directly that’s why I need a way to only allow access to my server through Cloudflare.
I watched a YouTube video where the guy added all the Cloudflare IP blocks to his .htaccess file but it didn’t work for me.
As @i40west said, if you are running your application on port
:8090 it is not supported by Cloudflare. This means that, currently, your application will only be accessible by IP address or if your DNS record is which mean requests aren’t going through Cloudflare.
If you make your server listen on a supported port, then you can enable Cloudflare and all requests will go through Cloudflare, which means you can block connections that are not through Cloudflare. Either with authenticate origin pull or firewall blocking all IPs that are not Cloudflare.
@Cyb3r-Jak3 I’m not running my application on
:8090. Also, I have Cloudflare enabled that’s the main reason why I want to block all IPs that are not Cloudflare.
Can you please direct me to an article or YouTube video where I can implement the authenticate origin pull or firewall blocking?
You can take a look at this YouTube video Block Net Blocks. The guy used firewall rules in the
.htaccess but it didn’t work for me.
Am now new to some of these firewall rules but I know you’ll figure it out.
The Cloudflare Docs will get you started with authenticated origin pull.
There is also an article that explains ways to only allow Cloudflare IP addresses.
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.