Wp-rocket: Add a notification when Mod Pagespeed is enabled and tell customers that it is likely to conflict with WP Rocket

Created on 26 Nov 2020  ยท  27Comments  ยท  Source: wp-media/wp-rocket

Is your feature request related to a problem? Please describe.
Add a notification when Mod Pagespeed is enabled and tell customers that it is likely to conflict with WP Rocket, and that they should turn it off on their server to avoid any issues.

Describe the solution you'd like
We can check if Mod Pagespeed is enabled, maybe using the response header they send, and show notification on WP Rocket dashboard.

Describe alternatives you've considered
N/A

Additional context
Mod Pagespeed adds the following headers:

  • X-Mod-Pagespeed for Apache
  • X-Page-Speed for Nginx
3rd party compatibility [S] cache medium enhancement

All 27 comments

Do we know why we have the conflict? Maybe we can work towards making WP Rocket compatible with mod_pagespeed rather than being incompatible with it.

cc: @sandyfigueroa @Tabrisrp

There is a lot of features duplication between WP Rocket and the pagespeed module. Working toward being compatible would be like working to be compatible with W3 Total Cache or Swift Performance.

Thanks for the feedback Remy ๐Ÿ‘ Makes sense.

On a ticket I worked on, I had to exclude the following to prevent a jQuery not defined error:
/wp-includes/js/jquery/jquery.js,(.*).js

The URL of the jQuery file was like this:
https://www.example.com/wp-includes/js/jquery/jquery.js,qver=1.12.4-wp.pagespeed.jm.gp20iU5FlU.js

What do you think about at least excluding that pattern in the core?

screenshot

Related ticket: https://secure.helpscout.net/conversation/1335093437/210973?folderId=2135277

@vmanthos If we are going ahead with the notice suggesting to disable Mod Pagespeed, then is this still required? Or is this one of the most common issues where some users could still get by without disabling mod_pagespeed?

My comment was out of context. I apologize.

If we are going ahead with the notice suggesting to disable Mod Pagespeed, then is this still required?

In such a case, it won't be. ๐Ÿ™

Grooming

Scope a solution โœ…

  1. Create new thirdparty compatibility class here: inc/ThirdParty/Plugins/PageSpeed.php

  2. Create new method to check if pagespeed is enabled as follows:-

private static function has_pagespeed () {
    if ( function_exists( "apache_get_modules" ) ) {
        if ( in_array("mod_pagespeed", apache_get_modules(), true ) ) {
            return true;
        }
        return false;
    }

    if ( function_exists( "get_headers" ) ) {
        if ( ! empty( $_SERVER["HTTP_HOST"] ) ) {
            if ( ! empty( $headers = get_headers(home_url() ?? null ) ) ) {
                if ( ! empty( $headers["X-Mod-Pagespeed"] ) || ! empty( $headers["X-Page-Speed"] ) ) {
                    return true;
                }
            }
        }
    }

    return false;
}
  1. create new callback for this action admin_notices to show the message.

Estimate the effort โœ…

[S]

@wp-media/productrocket we need the message that will appear to the customer.

@wp-media/productrocket @arunbasillal we have two questions please:-

  1. Where is the message to be displayed?

  2. Do we need to show the notice only at WP Rocket settings page or in all pages?

Thanks.

@engahmeds3ed @Tabrisrp

  • Can we use the same notice where we recommend to deactivate non-compatible plugins?
  • Instead of the deactivate button, we could link it to a doc? (The button says Deactivate and a doc opens up)

Is this possible? If yes, I will have a chat with Jonathan and confirm.

@wp-media/productrocket so the message will be like that:

WP Rocket: The following modules are not compatible with this plugin and may cause unexpected results:

Please confirm.

@arunbasillal @webtrainingwheels Is it the expected doc to link?

@GeekPress @webtrainingwheels I think we could create a specific documentation for the same. Or maybe a separate section in the doc with an #anchor text.

Please advise Lucy.

Had a quick chat with Ahmed and he said that we are not reusing rocket_plugins_to_deactivate(), and instead we are doing a new notice. (For reference, I had asked if this was possible to re-use - https://github.com/wp-media/wp-rocket/issues/3369#issuecomment-740163957)

@webtrainingwheels In that case, isn't it better if we simply have a notice as below instead of - https://github.com/wp-media/wp-rocket/issues/3369#issuecomment-750200923

WP Rocket: Mod PageSpeed is not compatible with this plugin and may cause unexpected results. More info

@arunbasillal @GeekPress
In our current docs we mention mod pagespeed in 2 places:

We could make a dedicated doc but what message/info would we like to convey? ๐Ÿค”

@webtrainingwheels

We could make a dedicated doc but what message/info would we like to convey?

  • I think a dedicated doc is better because it can be confusing otherwise when a user clicks from the notice. They will see the other titles and might not be sure if they landed in the right place.
  • The doc is basically a simple one that says it's not compatible with our features and a link to how to disable it. Just as we do now (with the external link). I don't think it needs much more than that.
  • We could reassure them that the PageSpeed module is not needed when they are using WP Rocket.

@wp-media/productrocket

image
This is the message view after adding it ( only waiting for docs url )

also I need to validate another point here,

check the following comment: https://github.com/wp-media/wp-rocket/pull/3390#issuecomment-750334876
we are saving the status of mod_pagespeed existence at transient for 1 day so we will make this check every day, I added this 1 day from my mind and only wanted to validate if this will make any problem with our customers or not?

@engahmeds3ed Here is the doc link: https://docs.wp-rocket.me/article/1376-mod-pagespeed

we are saving the status of mod_pagespeed existence at transient for 1 day so we will make this check every day, I added this 1 day from my mind and only wanted to validate if this will make any problem with our customers or not?

@engahmeds3ed Can we make the notice dismissible instead or it popping up every day? If users do not see a conflict with WP Rocket and wants to keep mod_pagespeed, they can simply dismiss the notice and never see it again. I think that would be better. If the notice pops up every day, we are definitely going to have users asking for an option to disable it.

@arunbasillal It's already like that so the clients can dismiss the message not to see it again.
I mean that if message is shown and then client removed mod_pagespeed so the message will disappear the next day or he can dismiss it for sure.

@engahmeds3ed To make sure I understand correctly:

  • User dismissed the notice
  • User decides to keep mod_pagespeed

In this case the notice is never displayed anymore, right?

(sorry for double checking)

Yes it will be like that one:
image

and when clicking on Dismiss this notice it will be removed for this user for ever.
I will check with you on slack when you are available.

@engahmeds3ed That looks neat to me ๐Ÿ‘

Just stumbled across this message in WP Rocket, and after disabling mod_pagespeed on the server, our PageSpeed Insight results have regressed.

I think this message should explicitly state which specific features are not compatible, so the user can decide if they would like them managed at the application or server level.

Could some of these optimisations actually be better managed at the server level?

Could some of these optimisations actually be better managed at the server level?

I can't see which feature done by mod_pagespeed could be better than what another tool like WP Rocket does.

@GeekPress Even so, the existing message is very vague (unexpected results!).

-The only 100% conflict I'm aware of is with optimize css delivery and we mention it here:
https://docs.wp-rocket.me/article/1321-critical-css-issues-fouc

If this statement by @webtrainingwheels is correct, then many may find it easier to just disable critical CSS in WP Rocket, than perform server administration uninstalling mod_pagespeed.

@twobyte Critical CSS is too much important to be disabled. Please correct, but mod_pagespeed doesn't do CPCSS as it should be done correctly.

By the way, mod_pagespeed isn't maintained since 2015. We will never recommend using an abandoned tool.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

webtrainingwheels picture webtrainingwheels  ยท  5Comments

webtrainingwheels picture webtrainingwheels  ยท  5Comments

crystinutzaa picture crystinutzaa  ยท  4Comments

jbma picture jbma  ยท  5Comments

Tabrisrp picture Tabrisrp  ยท  4Comments