Automatic Platform Optimization Enabled & I No Longer See Visitor IP?

Hello @yevgen

Please check these two screenshots and let me know shall I go ahead with - Use the X-Forwarded-For HTTP header. Only use if you have a front-end proxy or spoofing may result

OR

With this one:

I think Use the X-Forwarded-For HTTP header. Only use if you have a front-end proxy or spoofing may result option is good to go, please advise.

Thanks,
Richard

Currently Both CF-Connecting-IP and X-Forwarded-For headers are not sending real client IP when APO is enabled. We are working on a fix, ETA for the release is Wednesday.

6 Likes

Thanks Yevgen for the update and sorting this out. And great feature - a big thanks to your team for creating it!

It does not seem to be working. How do I know… just about had a heart attack when I received an email stating someone with an IPv6 email address logged into my website, and even though I just logged in… from an IPv4 address… spent the last 20-minutes a little “upset” and concerned and checking into things… but noticed quickly the IPv6 address was a Cloudflare one (which made me wonder about the VPN stuff, and if someone was using it to hack)

Just rebumping as it’s Wednesday
:+1:

I hope it will be fixed today.

If it’s any help, I’m finding this passes along an IPv6 address even when the client from which I’m connecting definitely has none.

The server upon which I’m running the cloudflare plug-in also doesn’t not have an IPv6 address, though Obviously I understand that’s not an issue.

Anyway, I hope that helps, and I hope we’re still on for a fix.

Thanks for all your work!

from @yevgen that IPv6 address is the Cloudflare IP used for the CF Worker subrequest

correct, we have a fix for this, pending a release to go it live.

4 Likes

Got it! Now I get the real user’s IP! Thank you.

1 Like

I am confirming that we’re seeing this as well. Thanks!

Can also confirm that it’s working for me. Thanks!

Both CF-Connecting-IP and X-Forwarded-For should contain real user IP.

8 Likes

Can you confirm you have now fully released the fix?

yes, it’s live.

3 Likes

Yep working great now, have marked this post as the solution.
Thanks!
Am seeing a noticeable speed increase.

1 Like

Thanks Cloudflare team! This feature is working fantastic. I’m seeing some drastic improvement on several sites where we’ve implemented it. It seems the more help a site needs, the more improvement it gets from APO. Sites that are already loading in the 3-4 sec range don’t see much improvement, but sites over 8-12 seconds are now dropping to 4-6 seconds!

1 Like

Yes confirmed working like a charm now.
Awesome guys, very much appreciated that you did look into this, after our remarks.
This shows Cloudflare really cares <3 about the community.

1 Like

Again 2a00:1fa1:c4b0:2733:0:5d:b898:e901, 2a00:1fa0:46dc:7425:6cec:d040:c876:d4fb :frowning:

Found this in our new relic:

Stack trace
E_WARNING: Cannot modify header information - headers already sent
in header called at /home/staging/public_html/wp-content/plugins/cloudflare/src/WordPress/Hooks.php (314)
in CF\WordPress\Hooks::initAutomaticPlatformOptimization called at /home/staging/public_html/wp-includes/class-wp-hook.php (287)
in WP_Hook::apply_filters called at /home/staging/public_html/wp-includes/class-wp-hook.php (311)
in WP_Hook::do_action called at /home/staging/public_html/wp-includes/plugin.php (478)
in do_action called at /home/staging/public_html/wp-settings.php (546)
in require_once called at /home/staging/public_html/wp-config.php (98)
in require_once called at /home/staging/public_html/wp-load.php (37)
in require_once called at /home/staging/public_html/wp-cron.php (44)

this is cause our cron is running through WP_CLI

Went to:

public function initAutomaticPlatformOptimization()
    {
      // add header unconditionally so we can detect plugin is activated
      if (!is_user_logged_in() ) {
        header( 'cf-edge-cache: cache,platform=wordpress' );
      } else {
        header( 'cf-edge-cache: no-cache' );
      }
    }

Changed to:

public function initAutomaticPlatformOptimization()
    {
		if ( !defined( 'WP_CLI' )) 
		{
	        if (!is_user_logged_in() ) {
	          header( 'cf-edge-cache: cache,platform=wordpress' );
	        } else {
	          header( 'cf-edge-cache: no-cache' );
	        }
		} 
    }
1 Like