Administrators uQs Posted July 12, 2022 Administrators Share Posted July 12, 2022 Plesk is running behind a load balancer, forwarder, or reverse proxy (Cloudflare, Google Cloud Load Balancer) Internal IP address of load balancer or proxy is displayed in domain logs (Domains > example.com > Logs) instead of the client's IP (real visitor's IP): Access 192.0.2.2 200 GET / HTTP/1.0 Cause Proxies and load balancers rewrite the origin IP address and specify the client's IP address in an additional HTTP header. Nginx enabled 1- Connect to the server via SSH. 2- Download and execute the next script in order to add the Nginx variables globally: curl -L -so /root/cf.sh https://plesk.zendesk.com/hc/article_attachments/4406613093138/cf.sh && chmod 700 /root/cf.sh 4- Execute the script: /root/cf.sh Apache only 1- Connect to the server via SSH. 2- Make sure that /etc/httpd/conf/httpd.conf has the following LogFormat: LogFormat "%a %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined 3- Create a new configuration file /etc/httpd/conf.d/cloudflare.conf and add Cloudflare IP addresses there: RemoteIPHeader CF-Connecting-IP RemoteIPTrustedProxy 173.245.48.0/20 RemoteIPTrustedProxy 103.21.244.0/22 RemoteIPTrustedProxy 103.22.200.0/22 RemoteIPTrustedProxy 103.31.4.0/22 RemoteIPTrustedProxy 141.101.64.0/18 RemoteIPTrustedProxy 108.162.192.0/18 RemoteIPTrustedProxy 190.93.240.0/20 RemoteIPTrustedProxy 188.114.96.0/20 RemoteIPTrustedProxy 197.234.240.0/22 RemoteIPTrustedProxy 198.41.128.0/17 RemoteIPTrustedProxy 162.158.0.0/15 RemoteIPTrustedProxy 104.16.0.0/13 RemoteIPTrustedProxy 104.24.0.0/14 RemoteIPTrustedProxy 172.64.0.0/13 RemoteIPTrustedProxy 131.0.72.0/22 RemoteIPTrustedProxy 2400:cb00::/32 RemoteIPTrustedProxy 2606:4700::/32 RemoteIPTrustedProxy 2803:f800::/32 RemoteIPTrustedProxy 2405:b500::/32 RemoteIPTrustedProxy 2405:8100::/32 RemoteIPTrustedProxy 2a06:98c0::/29 RemoteIPTrustedProxy 2c0f:f248::/32 4- Restart Apache service: For CentOS\RHEL: systemctl restart httpd For Debian\Ubuntu: systemctl restart apache2 Quote Link to comment Share on other sites More sharing options... 537 3.5k 188
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.