Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate with Cloudflare's new Automatic Platform Optimization #3180

Closed
gevcen opened this issue Oct 3, 2020 · 74 comments
Closed

Integrate with Cloudflare's new Automatic Platform Optimization #3180

gevcen opened this issue Oct 3, 2020 · 74 comments
Labels
3rd party compatibility Issues related to 3rd party compatibility like theme, plugin or hosting feature request Indicates new feature requests module: cloudflare needs: copywriting priority: high Issues which should be resolved as quickly as possible severity: moderate Feature isn't working as expected but has work around to get same value
Milestone

Comments

@gevcen
Copy link

gevcen commented Oct 3, 2020

Is your feature request related to a problem? Please describe.
Cloudflare has released a new feature called Automatic Platform Optimization. However, a problem arises is that it requires the official Cloudflare plugin to be installed, which therefore requires to disable WP Rocket's Cloudflare addon.

This leads to a problem, that users will never be sure that Cloudflare's cache would be cleared when the cache is cleared in WP Rocket. Eventough their official plugin supports clearing cache on content update, it doesnt answer the problem that Cloudflare cache won't be cleared when it's manually cleared by the user in WP Rocket.

Describe the solution you'd like
WP Rocket has all the necessary information in the Cloudflare addon (APIs...) that is sufficient for enabling the new Automatic Platform Optimization and those data can be sent to Cloudflare when we enable the feature.

Describe alternatives you've considered
Alternatively, we could add a toggle within the Cloudflare addon in WP Rocket to enable the new APO, and in this case it's WP Rocket who will make the "call" by sending the APIs. Similar button already exist for Dev Mode.

In fact, this alternative is the only possible way to integrate this feature into WP Rocket. Why? Well the other way around is hardly achievable because if we enable APO from Cloudflare dashboard itself, then I wonder how Cloudflare will find the APIs of WP Rocket's Cloudflare addon.

So the integration must come from the Cloudflare addon within WP Rocket, which I think many of us will appreciate being taken as a new priority.

Additional context
This is a major enhancement.

@PatrickD1985
Copy link

For now it will only work without having the WP Rocket Cloudflare add-on enabled as it conflicts with the Cloudlfare plugin BUT ALSO you now need the Cloudflare official plugin.

And indeed invalidating cache is a thing here.

For APO in an ideal situation I would love to see this be supported from within the add-on of WP-Rocket as this means one less plugin is needed and it will help to keep control over how Cache/Cloudflare is handled.

@Basilakis
Copy link

@PatrickD1985 is APO works for WooCommerce?

@PatrickD1985
Copy link

@Basilakis I would not be able to confirm that. As I have personal webshops.
Perhaps others can confirm this.

Please note; As it stands there is an issue currently with APO;
https://community.cloudflare.com/t/automatic-platform-optimization-enabled-i-no-longer-see-visitor-ip/210241/29
Estimated fix is coming Wednesday.

@Basilakis
Copy link

Thank you for Sharing

@ScottTravisHartley
Copy link
Contributor

I can confirm that APO does work with woocommerce because it does make exclusions for woocommerce related cookies and was included in the announcement post.

@PatrickD1985
Copy link

And I can confirm Cloudflare released a fix for https://community.cloudflare.com/t/automatic-platform-optimization-enabled-i-no-longer-see-visitor-ip/210241/45
Which has been tested by myself and multiple others not to break real ip checks anymore (security and other limitations kinda stuff).

So if the WP-Rocket team can look into an integration, that would be marvelous.

@CyberCr33p
Copy link

Lots of my clients need this.

@markllego
Copy link

Quick Question: May I know if I can use the Cloudflare APO with WP-Rocket (having the Cloudflare option disabled)? Thank you.

@PatrickD1985
Copy link

@markllego APO does work with the cloudflare integration off in WP-Rocket and using the official Cloudflare Wordpress plugin. (Currently that is the only way to use it with WP Rocket)

I am still in the process of seeing how much benefit this really gives. (Still not sure if it will yield any major advantage over our own setup, but I have not been able to test that yet due to the above mentioned issue). I will get back on that here in the upcoming week. From what I have seen so far it really seems to help with FCP, TTFB and the like.

But in the long run having WP Rocket support APO would be great whichever way you look at it.

For quick reference, after setting it up you should be able to see the below header on your requests;
x-via: speedwp/origin,cookie
That way you know it is being served through APO.

@markllego
Copy link

I can confirm that WP-Rocket is working fine with Cloudflare APO.

Header:

status: 200
x-cache: HIT
set-cookie: __cfduid=d47b0b49c7bf0f606541c64303647b1531602349346; expires=Mon, 09-Nov-20 17:02:26 GMT; path=/; domain=.teacherph.com; HttpOnly; SameSite=Lax; Secure
cf-cache-status: HIT
expires: Sat, 10 Oct 2020 14:53:22 GMT
vary: Accept-Encoding
x-via: speedwp/cache
last-modified: Sat, 10 Oct 2020 14:53:22 GMT
link: https://www.teacherph.com/wp-json/; rel="https://api.w.org/"
report-to: {"endpoints":[{"url":"https://a.nel.cloudflare.com/report?lkg-colo=22&lkg-time=1602349346"}],"group":"cf-nel","max_age":604800}
date: Sat, 10 Oct 2020 17:02:26 GMT
cf-ray: 5e01e8b6eeb40abc-NRT
cf-edge-cache: cache,platform=wordpress
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
nel: {"report_to":"cf-nel","max_age":604800}
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
content-encoding: br
age: 6532
strict-transport-security: max-age=31536000; includeSubDomains; preload
cf-request-id: 05b50fc65100000abc9ca4f200000001
server: cloudflare
cache-control: max-age=0
x-frame-options: SAMEORIGIN
content-type: text/html; charset=UTF-8
:status: 200

@arunbasillal arunbasillal added 3rd party compatibility Issues related to 3rd party compatibility like theme, plugin or hosting feature request Indicates new feature requests module: cloudflare waiting for feedback labels Oct 14, 2020
@webtrainingwheels
Copy link

@patche81
Copy link

Any update regarding this ? this is a major feature IMHO

@vmanthos
Copy link
Contributor

vmanthos commented Nov 3, 2020

@patche81
Copy link

Folks we need this in CORE asap

@webtrainingwheels
Copy link

@tonydehnke
Copy link

How can we access/see what is in those urls @webtrainingwheels - as they require a login?

@webtrainingwheels
Copy link

@tonydehnke They are for our team's internal use only :)

@sejoker
Copy link

sejoker commented Nov 21, 2020

Hey, I'm an engineer working on Automatic Platform Optimization, let me know if you need any help with the integration. I know we haven't published docs on api.cloudflare.com for the feature. We are planning to finalize last parameters and publish it in the coming 2 weeks.

@viobru
Copy link
Contributor

viobru commented Nov 23, 2020

@sunnyt7
Copy link

sunnyt7 commented Dec 5, 2020

I would like to see this as well. Running into a lot of issues using the two together - particularly with Nginx server-side and APO caching getting mixed up.

For example, if I use WP Rocket to minify CSS, the HTML often links to an outdated minified file (see: https://community.cloudflare.com/t/cloudflares-apo-with-wp-rockets-minified-css/225906)

Or changes to content won't be visible for quite some time, and requires a manual purge of all caches. Ideally, WP Rocket could purge them all at once like it can when not using APO.

@scorpionmit01
Copy link

Can we just turn off the WP-Rocket Cloudflare integration? Faster for no downside is a good one, but there appears to be an issue with CSS.

@vergosteak
Copy link

Hope we will see an integration soon ! It would be a major enhancement. I really want to use APO with WP rocket

@crystinutzaa
Copy link
Contributor

@sejoker I am the developer of WP Rocket and I would love to get in touch and discuss about the integration with Automatic Platform Optimization. Do you have any initial documentation about it where I can see how should be integrated with WP Rocket?

You can reach me by email at: cristina@wp-media.me and keep in touch on email 😄

@scorpionmit01
Copy link

scorpionmit01 commented Dec 17, 2020 via email

@crystinutzaa
Copy link
Contributor

@scorpionmit01
Edit the website means that a post / page content was updated.
This means that WP Rocket cache is expired. If Cloudflare APO is enabled, when WP Rocket cache is cleaned, it will trigger also the cleaning of Cloudflare cache (to be in-sync), so there will not be any errors related to out-of-sync cache.

I would love to give you an ETA for this change, however I don't have a fixed deadline for it.

This task is groomed now and is waiting to be planned for a future sprint, however I cannot guarantee that it will be released before 1 March

@GeekPress
Copy link
Contributor

GeekPress commented Feb 17, 2021

@crystinutzaa Thanks for the extra info. It seems an option will be the best approach based on your last feedback.

Label
Automatic Platform Optimization (APO)

Description
Serve your entire site from Cloudflare edge network. More info.

@vmanthos @webtrainingwheels I ping you on to have your feedback. Does the wording sound good to you?

@patche81
Copy link

any ETA regarding this ?

@scorpionmit01
Copy link

scorpionmit01 commented Feb 28, 2021 via email

@GeekPress
Copy link
Contributor

any ETA regarding this ?

@patche81 We don't have any ETA to provide you yet until a milestone will be set on this issue.

@scorpionmit01 The risk will be > Cloudflare might serve outdated content if you don't flush the cache?

@ScottTravisHartley
Copy link
Contributor

That is part of the issue the bigger issue is when WProcket's cache is cleared automatically and Cloudflare's is not. This can then cause a 404 error on minified CSS/JS files which can cause the layout to become out of sync.

@SimJoSt
Copy link

SimJoSt commented Mar 8, 2021

It would be great to have this big feature mentioned on the new roadmap for non-technical users as well: https://feedback.wp-rocket.me/roadmap

@dreamjobma
Copy link

I think they want to keep this for WP Rocket 4.0

@GeekPress
Copy link
Contributor

@SimJoSt It hasn't been added to our new roadmap as we already know it's something we have to work on ;)

@SimJoSt
Copy link

SimJoSt commented Mar 9, 2021

@GeekPress that's true :)
But not every customer and interested party will read through the GitHub issues, so making it transparent to them, especially with an issue this big, would be very forthcoming 🙏

@GeekPress
Copy link
Contributor

@SimJoSt You're right. Here we go: https://feedback.wp-rocket.me/16

@GeekPress GeekPress added this to the 3.10 milestone Mar 24, 2021
@kumzee
Copy link

kumzee commented Apr 7, 2021

Hi guys,

One of my client had broken page layout over the Easter break (4 days) losing half their conversions.
Any idea when is this update being rolled out?

@GeekPress
Copy link
Contributor

@kumzee Hi 🤚 As mentioned in the milestone section, it's scheduled for 3.10. No ETA yet about the release date.

@roadsunknown
Copy link

3.8 December 9, 2020
3.7 August 27, 2020
3.6 June 9, 2020

On average, minor version releases are every 3 months. This would assume a 3.9 release in March but that did not happen so at the earliest we should be expecting 3.10 at least 3-4 months from now or over 9 months after this issue was first opened and APO was released.

@wp-media wp-media locked and limited conversation to collaborators Apr 8, 2021
@remyperona remyperona changed the title Enhancement - Integrate with Cloudflare's new Automatic Platform Optimization Integrate with Cloudflare's new Automatic Platform Optimization Apr 9, 2021
@DahmaniAdame
Copy link
Contributor

APO supports a separate cache for desktop and mobile devices.
https://support.cloudflare.com/hc/en-us/articles/360049822312#h_01ERZ6QHBGFVPSC44SJAC1YM6Q

And they seem to have a API to control it: cache_by_device_type
https://api.cloudflare.com/#zone-settings-change-automatic-platform-optimization-for-wordpress-setting

Could be a good thing to pair with our Separate Cache for Mobile devices feature.

@GeekPress GeekPress reopened this Jun 16, 2021
@GeekPress GeekPress removed this from the 3.10 milestone Jun 16, 2021
@vmanthos
Copy link
Contributor

@alfonso100
Copy link
Contributor

@DahmaniAdame
Copy link
Contributor

@remyperona remyperona removed the effort: [M] 3-5 days of estimated development time label Apr 19, 2023
@remyperona
Copy link
Contributor

Scope a solution ✅

Settings Page

  • Add new Automatic Optimization Platform checkbox to the cloudflare settings section
  • Add a button to refresh the data from Cloudflare
  • Add a method to serve as callback for the data refresh AJAX call
  • Update the settings page JS to handle the new AJAX call

Estimate the effort ✅

Effort [M]

Settings update

  • When saving the settings after changing the option, make and API call to the APO CF endpoint to enable/disable it
  • Use the separate cache for mobile option value to send the Cache By Device Type value
  • If the separate cache for mobile option is changed while the APO option is enabled, make an update call to the APO CF endpoint
  • Store the API call response in an network option + a network transient to save the call done for one week
  • Display an error message if there is an error during the API call

Estimate the effort ✅

Effort [M]

Cloudflare class

  • Add a method to the Cloudflare class to check if APO is available for the currently configured account
  • Add a method to handle the APO endpoint call, using the PATCH method type

Estimate the effort ✅

Effort [S]

Multisite support

  • If multisite is enabled, and APO is enabled on a subsite, synchronize the value of the specific mobile cache per device
  • Grey-out the specific cache for mobile option to prevent changing it

Estimate the effort ✅

Effort [S]

@piotrbak piotrbak added this to the 3.14 milestone Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3rd party compatibility Issues related to 3rd party compatibility like theme, plugin or hosting feature request Indicates new feature requests module: cloudflare needs: copywriting priority: high Issues which should be resolved as quickly as possible severity: moderate Feature isn't working as expected but has work around to get same value
Projects
None yet
Development

No branches or pull requests