wp-rocket icon indicating copy to clipboard operation
wp-rocket copied to clipboard

Integrate with Cloudflare's new Automatic Platform Optimization

Open gevcen opened this issue 5 years ago • 73 comments

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.

gevcen avatar Oct 03 '20 09:10 gevcen

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.

PatrickD1985 avatar Oct 04 '20 08:10 PatrickD1985

@PatrickD1985 is APO works for WooCommerce?

Basilakis avatar Oct 05 '20 17:10 Basilakis

@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.

PatrickD1985 avatar Oct 05 '20 18:10 PatrickD1985

Thank you for Sharing

Basilakis avatar Oct 05 '20 19:10 Basilakis

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.

ScottTravisHartley avatar Oct 06 '20 15:10 ScottTravisHartley

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.

PatrickD1985 avatar Oct 08 '20 16:10 PatrickD1985

Lots of my clients need this.

CyberCr33p avatar Oct 08 '20 16:10 CyberCr33p

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

markllego avatar Oct 08 '20 20:10 markllego

@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.

PatrickD1985 avatar Oct 08 '20 21:10 PatrickD1985

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

markllego avatar Oct 10 '20 17:10 markllego

Another request/inquiry: https://secure.helpscout.net/conversation/1309075581/202360?folderId=273766

webtrainingwheels avatar Oct 16 '20 20:10 webtrainingwheels

Any update regarding this ? this is a major feature IMHO

patche81 avatar Oct 29 '20 14:10 patche81

Related ticket: https://secure.helpscout.net/conversation/1325982650/207868/

vmanthos avatar Nov 03 '20 10:11 vmanthos

Folks we need this in CORE asap

patche81 avatar Nov 17 '20 04:11 patche81

Related: https://secure.helpscout.net/conversation/1342363416/213604?folderId=4130683

webtrainingwheels avatar Nov 19 '20 18:11 webtrainingwheels

https://secure.helpscout.net/conversation/1337164234/211666?folderId=4130683

webtrainingwheels avatar Nov 21 '20 02:11 webtrainingwheels

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

tonydehnke avatar Nov 21 '20 02:11 tonydehnke

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

webtrainingwheels avatar Nov 21 '20 02:11 webtrainingwheels

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.

sejoker avatar Nov 21 '20 18:11 sejoker

Related: https://secure.helpscout.net/conversation/1342665684/213710/

viobru avatar Nov 23 '20 11:11 viobru

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.

sunnyt7 avatar Dec 05 '20 19:12 sunnyt7

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.

scorpionmit01 avatar Dec 08 '20 00:12 scorpionmit01

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

vergosteak avatar Dec 10 '20 07:12 vergosteak

@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: [email protected] and keep in touch on email 😄

crystinutzaa avatar Dec 14 '20 10:12 crystinutzaa

Hi, thanks for reaching out! I am not an expert on Automatic Platform Optimization, but Cloudflare is pushing it pretty hard. Happy to help and give you my thoughts.

Requirements Document:

  1. Website should have the Cloudflare Plugin v3.8.7 or higher
  2. WP Rocket will need to let Cloudflare's plugin manage it
  3. PHASE 2 (not MVP) - WP Rocket should have a "use Cloudflare Automatic Platform Optimization" button that sets up the Cloudflare Plugin for WP Rocket Sites

Here is where I see their Documentation: https://support.cloudflare.com/hc/en-us/articles/360049822312-Understanding-Automatic-Platform-Optimization-APO-with-WordPress

The main thing I see is that Cloudflare will manage the Cloudflare plugins based upon native hooks. WP Rocket would need to hop in prior to Cloudflare and purge WP Rocket's cache https://support.cloudflare.com/hc/en-us/articles/115002708027-Cloudflare-WordPress-Plugin-Automatic-Cache-Management-

I think that the main thing will be to effectively be running with Cache Everything, at least as much as possible. You'd need to test, but I think if you can hook into their cache clearing events first, we should be golden.

Alex

On Mon, Dec 14, 2020 at 5:42 AM Cristina Soponar [email protected] wrote:

@sejoker https://github.com/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: [email protected] and keep in touch on email 😄

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/wp-media/wp-rocket/issues/3180#issuecomment-744351656, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYN4VJOS6X4SL7A4UD33ALSUXTX7ANCNFSM4SCREAKQ .

-- Book a meeting with me https://www.cloudhq.net/meeting/[email protected]

scorpionmit01 avatar Dec 17 '20 04:12 scorpionmit01

Related ticket: https://secure.helpscout.net/conversation/1370790935/224134?folderId=4130683

viobru avatar Dec 17 '20 17:12 viobru

Any progress on this? Much needed feature.. Can i help in any way?

luissimo avatar Jan 13 '21 20:01 luissimo

Please give us this feature asap

dreamjobma avatar Jan 13 '21 20:01 dreamjobma

Hi @crystinutzaa , any update about integration between APO and WP-Rocket?

Do you have a WP-Rocket setup to act as a workaround to use APO till a final solution will be released by you (maybe disable CSS minification on WP-Rocket)?

thanks!

Bistoman avatar Jan 13 '21 22:01 Bistoman

another request: https://secure.helpscout.net/conversation/1400721336/232639?folderId=4130683

webtrainingwheels avatar Jan 21 '21 00:01 webtrainingwheels