Closed UTCGilligan closed 4 months ago
YOURLS uses GEOIP for stats, but the F5 load balancer (and Cloudflare) doesn't pass real IP through. We solved this in WordPress by adding to config.
Create a YOURLS plugin to fix it.
# Support Akismet seeing Real IP from F5 and other frontends if (isset($_SERVER['HTTP_CLIENT_IP'])){ $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CLIENT_IP']; }elseif(isset($_SERVER['HTTP_CF_CONNECTING_IP'])){ $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP']; }elseif(isset($_SERVER['HTTP_X_FORWARDED_FOR'])){ $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR']; }elseif(isset($_SERVER['HTTP_X_FORWARDED'])){ $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED']; }elseif(isset($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])){ $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_CLUSTER_CLIENT_IP']; }elseif(isset($_SERVER['HTTP_FORWARDED_FOR'])){ $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FORWARDED_FOR']; }elseif(isset($_SERVER['HTTP_FORWARDED'])){ $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FORWARDED']; }elseif(isset($_SERVER['HTTP_X_REAL_IP'])){ $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_REAL_IP']; } if(isset($_SERVER["HTTP_CF_VISITOR"])){ if (strpos($_SERVER["HTTP_CF_VISITOR"], "https") || $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { $_SERVER['HTTPS'] = 'on'; }}
YOURLS uses GEOIP for stats, but the F5 load balancer (and Cloudflare) doesn't pass real IP through. We solved this in WordPress by adding to config.
Create a YOURLS plugin to fix it.