Where can I define global server variable?
Permalink
I'm using Cloudflare in conjunction with a load balancer - long story short, it does weird things to any php that records IP addresses (like the Advanced Forms package). I have a fix for it, but rather than patch each different package, where would the best place in c5 be to override a $_SERVER variable to it makes the change globally? I'm basically replacing all instances of $_SERVER['REMOTE_ADDR'] with:
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP']; } else { $_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_X_FORWARDED_FOR"]; }