How to see real IP instead of Cloudflare IP's when using RunCloud Openlitespeed servers ?
The process of restoring real IP instead of Cloudflare IP is a simple step in RunCloud Nginx servers since they provide those configurations as "predefined" however that is not the case for the OpenLiteSpeed servers. Here, we are trying to cover the steps you need to take to resolve this issue.
Introduction
If you're using a RunCloud Openlitespeed server and want to see the real IP of the visitors to your website instead of the Cloudflare IPs, you're in the right place. In this blog post, we'll go over the steps you need to take to make this happen. This is a simple process that can be done in just a few minutes, and it will allow you to see the real IP of the users visiting your website, which can be useful for a variety of reasons.
But before we get started, let's go over a brief explanation of what Cloudflare is and how it works.
What is Cloudflare?
Cloudflare is a content delivery network (CDN) that provides security and performance optimization for websites. When you use Cloudflare, it acts as a middleman between your website and the visitors to your website. It intercepts the requests from the visitors and then sends them to your website. This process has several benefits, such as reducing the load on your server, improving the security of your website, and speeding up the loading times for your website.
However, one downside of using Cloudflare is that it hides the real IP of the visitors to your website. Instead of seeing the real IP, you'll see the Cloudflare IPs. This can be frustrating if you want to see the real IP of the users visiting your website, for example, if you're trying to track down a specific user or if you're trying to block a specific IP.
Fortunately, there is a way to see the real IP of the users visiting your website when you're using a RunCloud Openlitespeed server and Cloudflare. In the next section, we'll go over the steps you need to take to make this happen.
Step 1
First, Let me help you with what exactly this configuration will do. In a normal scenario, the web application access log will show the website accessing users' public IP however if they are using Cloudflare CDN then the server log will have the IP of Cloudflare instead of the real users IP. This will be an issue if you are facing an attack and you wish to block a particular IP etc. So let me help you with the steps to resolve this issue.
Please go to https://manage.runcloud.io/servers, Here you can find all your servers. Select the required OLS server then select "LiteSpeed" from left side options.
Here, you can see the /usr/local/lsws/conf/httpd_config.conf file content, we need to add following line
Trust Ip Only {
useIpInProxyHeader 1
}
You can see the following screenshot as example
Please make sure you are not adding any space Infront of 'Trust' since it can cause errors.
Now, you will see real user IP being logged in your all web application logs. Please note, this is a server wide change so no, need to add it for each web application.
Conclusion
In this blog post, we've gone over how to see the real IP of the users visiting your website when you're using a RunCloud Openlitespeed server and Cloudflare. By following the steps outlined above, you can quickly and easily configure your server to show the real IP of the users, which can be useful for a variety of reasons.
If you have any questions or run into any issues along the way, feel free to leave a comment below and we'll be happy to help.
Thank god, I finally found it.
ReplyDeletethank you...
ReplyDelete