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

Improve plugin compatibility with HealthCheck - PageCache #6042

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

tkalimullin-coludlinux
Copy link
Contributor

Description

When mandatory cookies are set for the plugin, the home page speed check from WordPress SiteHealth does not return the correct result, the page is not cached.

The SiteHealth tool should be thought of as a "speed tool".

In order for the is_speed_tool method to return true, the request from SiteHealth must be defined as "speed tool".

This can be easily achieved as there is a "UserAgent" check in the is_speed_tool method. Requests sent from SiteHealth will pass the "WP Rocket" header, allowing the mandatory cookie test to be skipped.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which improves an existing functionality)

How Has This Been Tested?

  1. Place in header.php themes sleep(1);
  2. Install the YayCurrency plugin or add the following lines to the wp-rocket-config/site.php config
$rocket_cache_mandatory_cookies = 'yay_currency_widget';
$rocket_cache_dynamic_cookies = array(
	0 => 'yay_currency_widget',
);
  1. Open WordPress SiteHealth (/wp-admin/site-health.php)
  2. Verify that the error has appeared:
    Median server response time was 1068 milliseconds. It should be less than the recommended 600 milliseconds threshold.
  3. Apply the changes from the commit, the error should no longer appear when the WP Rocket plugin is enabled.

Checklist:

Please delete the options that are not relevant.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant