wp-media / wp-rocket

Performance optimization plugin for WordPress
https://wp-rocket.me
GNU General Public License v2.0
698 stars 217 forks source link

Make our file optimizations compatible with Jetpack's CDN #2394

Closed webtrainingwheels closed 3 months ago

webtrainingwheels commented 4 years ago

Jetapck_site_accelerator

When customers active Jetpack's "site accelerator" features, their CSS/JS files are served from Jetpack's CDN. WP Rocket can no longer process them for minify/combine etc. So customers have to choose either the benefit of the CDN, or the benefit of our options. If technically feasible it would be great to be able to handle those files. See HS tags "jetpack cdn" and "jetpack site accelerator" for related tickets.

Steps to reproduce

  1. You need a site with Jetpack plugin active and connected to WordPress.com
  2. Make sure that some File Optimizations are enabled in WP Rocket, like Combine CSS / JS
  3. Go to Jetpack settings > Performance > Enable site accelerator > Speed up static file load times
  4. Clear the WP Rocket cache
  5. Observe that files served from Jetpack's CDN won't be processed by WP Rocket:
remyperona commented 4 years ago

Jetpack site accelerator speed up for static files rewrites the URLs of files from WP core, Jetpack and WooCommerce to the URL coming from wp.com.

It's not technically possible for us to optimize those and at the same time using Jetpack CDN.

@arunbasillal @GeekPress We need to decide what is the best approach there, because this option and our file optimization options for CSS/JS can't be compatible.

GeekPress commented 4 years ago

@Tabrisrp It should work for JS minify / combine as external scripts are included in the process, isn't?

If so, it means that if we include external CSS in the minify/combine process, this issue will be fixed.

remyperona commented 4 years ago

Currently it would be for combine JS, we don't process any external CSS/JS files when doing minify.

And I believe we have reports of combine JS not working correctly with Jetpack CDN enabled at the same time, something along the line of jQuery not defined issue. See #2296

arunbasillal commented 4 years ago

I am trying to wrap my head around this problem.

webtrainingwheels commented 4 years ago

@arunbasillal please check the conclusion of the discussion in #2296 , that issue turned out to be a bit different and led to the creation of #2493 instead.

webtrainingwheels commented 4 years ago

@arunbasillal @GeekPress Since 3.7 this issue isn't really relevant anymore (or, maybe it's just different now)

Now, if Jetpack CDN for Static Files is activated, we will process everything and they will end being locally hosted (except any excluded file), so there is no point in using Jetpack CDN in that case.

Unless we kind of want to do the opposite and recognize Jetpack as a normal CDN, where the files would be optimized and then served from the Jetpack domain?

GeekPress commented 4 years ago

Now, if Jetpack CDN for Static Files is activated, we will process everything and they will end being locally hosted (except any excluded file), so there is no point in using Jetpack CDN in that case.

In terms of performance, this behavior is better for our users.

Why?

Based on this comment https://github.com/wp-media/wp-rocket/issues/2394#issuecomment-597075883, Jetpack CDN isn't applied on all files.

I suppose for websites with an international audience, Jetpack CDN isn't enough for them. They will want to have a CDN applied on all their files, and not just on WP Core, Jetpack and WooCommerce. They will need to use a global CDN solution.

For websites without an international audience, Jetpack CDN will add a useless extra DNS resolution to solve.

piotrbak commented 3 months ago

Not enough feedback here to be implemented in the nearest future.