Drupal 7 at shared hosting behind Cloudflare I use Drupal 7 at a share hosting account (with apache server) and I use Cloudflare.com CDN.
Cloudflare ip token (at webform etc) shows cloudflare IP instead of visitor's original IP.

At settings.php I put

$conf['reverse_proxy'] = TRUE;
$conf['reverse_proxy_header'] = 'HTTP_CF_CONNECTING_IP';


These did not seem to work.

What seems to work was:
the instructions given by cloudflare for PHP

if ($_SERVER["HTTP_CF_CONNECTING_IP"]) {$_SERVER["REMOTE_ADDR"] = $_SERVER["HTTP_CF_CONNECTING_IP"]; }  


or alternatively what was written at drupal cloudflare module (which is only for drupal 6 and not 7)

$_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"] ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER["REMOTE_ADDR"]; 


The questions are


why the typical drupal settings ($conf['reverse_proxy_header) did not work, and how can I make them work? 
If not, then which of the 2 solutions that worked for me is more secure or better?
Should I setup $conf['reverse_proxy_addresses'] with cloudflare ips,
or it's useless since $conf['reverse_proxy_header'] does not work
anyway?
Why don't you install the CloudFlare - Free Reverse Proxy, Firewall, and Global CDN module? The module comes with instructions on how to solve this problem:

Installation Instructions:


  Install and Enable this module. Add one line of code at the end of
  your settings.php file:

$_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"] ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER["REMOTE_ADDR"];

  
  Save your email address and CloudFlare API key to the CloudFlare administration screen on your Drupal web site (admin/settings/cloudflare).