-
Notifications
You must be signed in to change notification settings - Fork 227
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
Page caching is not detected (AMP Di AMP Project Contributors) #4638
Comments
Hello @KinG-InFeT and thank you for the issue. The way in which AMP plugin is looking for a page caching is very unreliable. We'll check if there's anything we can do on our side, but most likely, it'll has to be fixed on the AMP plugin side. |
hi @piotrbak , i open new issue to AMP plugin for find a new solutions. |
@piotrbak hi:
What is unreliable about it? |
Hello @westonruter and thanks for your comment. The existence of browser caching headers doesn't mean that the page is cached. Our plugin, to handle the browser caching and make sure that it's invalidated correctly uses Last-Modified header. There's also ETag header that could be used in a similar way. The Varnish part is of course totally correct, but some hosts are not using browser caching for It's also possible the that websites without page caching applied will just use the browser caching headers for |
Thanks for the additional information. We tested with several page caching plugins and they were consistently using
I recall considering It's clearly difficult to sniff with 100% accuracy whether page caching is present based on response headers. So what's important is to detect most cases and err on the side of false positives rather than false negatives.
Alas. Good to call that out. I suppose we'll have to hard-code such custom response headers.
Wouldn't it be beneficial for you to also send the |
The only idea that comes to my mind is to make calls to the cached and not cached version of the page and based on loading times determine whether it's served from static file or not:
When it comes to the
At the end, how do you think we could move forward, to make sure not to confuse our mutual customers? |
I think we tried going down that route. The problem with cache-busting query parameters is that caching is some caching plugins disable caching altogether when there is a query parameter present.
It seems like we'll need to just include |
This solution will resolve all problems between our products, so it's very good from our point of view. Thank you and let me know if there's anything we can help you with. |
I think the problem is it's not consistent. Some caching plugins may disable caching altogether when a random query parameter is present. Other plugins may strip it out silently and serve a response as if it wasn't present in the first place. Others will cache it separately from a page without the query parameter. All of this variability, along with the variability introduced by the network itself, seems to make a timing-based check for page caching infeasible. The only sensible timing-based check seems to me to re-fetch the homepage 3 times, and if any of them response in less than 200ms then we can presume a page cache is responsible for such a “fast” response, or else the site is fast enough that page caching is not necessary. PageSpeed Insights recommends a TTFB under 200ms. So I'd say we change the test so that instead of checking for page caching we instead check for the need for page caching. As part of that we:
The test results would then be as follows:
In the second case, this catches the case where your site responds just fine when it is getting little traffic. But if the site lacks page caching, it can quickly crash if no page caching is in place. |
OK, we've merged the improved page caching test: ampproject/amp-wp#6849. See the various test scenarios here: ampproject/amp-wp#6849 (comment) |
yes, now Site Health not return the error for cache 👍 |
Thank you @westonruter, it looks great! |
Describe the bug
into wordpress Site Health out the cache error for plugin
Plugin WP-Rocket version: 3.10.5.1
Plugin AMP version: 2.2.0
Wp version: 5.8.3
Theme: Neve
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Backlog Grooming (for WP Media dev team use only)
The text was updated successfully, but these errors were encountered: