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"];
            }

hursey013
 
jordanlev replied on at Permalink Best Answer Reply
jordanlev
Just toss it in the top-level index.php file, before the require('concrete/dispatcher.php'); line.
hursey013 replied on at Permalink Reply
hursey013
Thanks Jordan - I'll give it a shot.