Is there any way how to use hosts.allow and hosts.deny files to restrict access to the websites (Nginx)?
This does not work:
hosts.allow file content: nginx: SOME-IP-ADDRESS hosts.deny file content: nginx: ALL
I am going to use Cloudflare services and want allow connections to Nginx only from Cloudflare IP addresses but can't find a way how to do it.
Yes, I know, I can allow/deny connections by IP address in Nginx configuration file but not in this case because I use:
set_real_ip_from CLOUDFLARE_IP_ADDRESSES; real_ip_header CF-Connecting-IP;
which converts Cloudflare IP addresses into users IP addresses and after that I can not know if the request is coming from Cloudflare. I want to allow connections only from Cloudflare but at the same time I want to know the real IP address of each http request.