-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
A little help with updating cache #24326
Comments
@codewiz @csLittleye @Gregable have been helpful with AMP update issues in the past. Thank you. |
I was able to use a subdomain to test flushing the logic, and managed to get an "OK" response. So at this point, that would resolve 3) above. For 4) I found that it needs to be For 1) I still get a 404 for the subdomain I tried, so I'm still not sure what I'm doing wrong there. |
Someone or something seems to have flushed the key cache, and now update-cache requests to www.androidpolice.com succeed, so that's great. However, I'm still not clear about something. It seems there are multiple copies of the cache created by various Google properties (like Discover, Chrome Discover, Google News, search), and there are subtle differences between them, such as vs Note the extra parameter as well as These caches currently differ, even after we sent a cache-update request for https://www.androidpolice.com/2019/08/31/android-police-now-supports-google-amp/?amp, and it returned an OK:
Appreciate any clarification. |
Furthermore, we can't seem to get the content to update even with max-age=30, with As a test, I changed the link below to "working on for a few years". https://www.androidpolice.com/2019/08/31/android-police-now-supports-google-amp/?amp: https://www-androidpolice-com.cdn.ampproject.org/c/s/www.androidpolice.com/2019/08/31/android-police-now-supports-google-amp/?amp: This is still the old link. That's after
Cache-control is max-age: 30. So why is it not updating? (By the time you see the cache page, it may already update, but we're trying to resolve the timeliness of such updates.) |
Thanks for the detailed write-up. I'll try to answer a few of the questions:
|
Thanks. The question is why
I want to say I waited around 10 minutes, but I'll have to test again. I expected it to refresh after 30 seconds though. |
In general:
|
Reported internally to Google as b/140420052 |
3 hours later, none of the updates still propagated to the AMP caches. Here's the original
|
One issue observed (discussed over slack, but adding here for posterity) is that the The |
To follow up on Greg's reply, there seems to be a related bug somewhere in AMP CDN code which sometimes redirects urls with For example: Note how |
cf. ampproject/amp-wp#1383 where we are thinking to cause the AMP plugin to generate paired URLs with |
I was also told today (by @Gregable) that we should be using |
Both are fine. The important element is that s-maxage is intended to override max-age for intermediary caching. |
I just remembered what confused me further previously. https://developers.google.com/amp/cache/overview:
This document makes it seem like Clarifications from the AMP core team would be greatly appreciated. |
Related: #19988. @patrickkettner Any updates on the above questions? Thanks. |
Related: #25264 ? |
Hi, we're trying to plan ahead with converting the whole androidpolice.com site to AMP, now that we have single posts working. But now we have AMP CDN caching concerns. Imagine how many pages we'd actually need to purge after a single post is published. Every single pagination page for the homepage, categories, tags, author, and any matching search terms would need to be updated. There's no way WP even knows all of them, let alone W3 itself. Such pages are probably left to expire and regen on their own, which, tbh, is fine - our W3 caching is set to like 30 minutes and I can live with pagination not working 100% on pages 5+. But what about AMP caching? Will it actually re-query the source properly without a call to update-cache or will it cache all these pages forever until basically the next post happens to bust that cache? I wish there was a way to tell AMP that every page can only be cached for up to, say, 5-30 minutes, and have it refresh from source no matter update-cache call or not. This is actually a potential roadblock for our plan to convert the whole site and not just post pages to AMP. Any advice here? |
Just pinged b/140420052, letting people know that this issue persists |
Update: the team that works on the AMP Cache is actively investigating this to see if there's an issue. |
Hello, We've had similar struggles getting up and running on our end. I've written some sample code to demonstrate the issue here: https://gist.github.com/nbcsteveb/53f13a7f7704e446a22f89dfdd94b050 Response comes back:
I've reached out to our internal contact and they've advised me to comment in this thread for further assistance. Thank you. |
I'm also stuck at this point (on top of the cache not respecting the max-age header). I suppose the other issues suggest that the problem could be that the public key isn't robotable, but I definitely made an effort to make sure that's not the case. What's weird is that if I access the url that server side renders the articles, and hard refresh, every once and a while it will load different versions of the article. And all of those can be different what is shown in the AMP viewer through a google search. Here are the response headers from the ssr link:
Could share the generated update-cache url if that helps. @morsssss did you ever find an issue in your investigation? Edit: In my case, our main issue was apollo client caching the data. That compounded with our own caching and then AMP to lead to a bad outcome. But ultimately it wasn't an amp issue at all. |
@tannerbaum , this thread ended up spanning a number of cache-related questions. We should really close it so that new reports like yours can get noticed! (I'm sorry it didn't.) Usually these come down to various complexities in making the request with the right URL, making sure servers are available to serve fresh content when it's needed, etc. I can only ask if @Gregable spots any issue here. |
@morsssss ha I definitely see what you are saying about this issue. I didn't want to make another issue for you guys at the risk of adding to the noise, but maybe I will go ahead and try to lay out everything I can in a new issue, including writing the actual url being generated. Thanks for your response! |
Hi I was pointed by @westonruter to this post again thanks to him, via a WordPress issue I created at the AMP Plugin Support here I have gone through many posts on clearing the AMP Cache, concerning this post Titled - " Keeping things fresh with stale-while-revalidate " I have tried this on my website, which is an AMP Native Site. To check, I am using a Quote of the Day in the Footer that's updated daily with a cron automatically. to construct the URL for the cache I followed the same pattern that is https://cdn.ampproject.org/c/s/netnaps.com for my home page, to the server-side I added: Header set Cache-Control "max-age=15, public,stale-while-revalidate=59" With files match, I could remove the public and then tried with a refreshing, and that worked for me! The page was updated manually. For the bulk update, I don't have much of the URL's, but if I have can make a script and set a cron to ping the URLs in bulk automatically but will that harm the site with google that I am not sure and could not find an answer to the same on the web. I also followed this page from google here , that states the same " stale-while-revalidate " I would look forward to more clarity on the same issue for serving fresh content by purging cache. If this can be done via the default plugin it would be great. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Hi,
We recently launched AMP after a year of working on it (see https://www.androidpolice.com/2019/08/31/android-police-now-supports-google-amp/?amp), but realized that content updating doesn't work, and we need a little help.
https://www.androidpolice.com/.well-known/amphtml/apikey.pub was originally not served as plaintext, but that's been rectified is. It's possible that all we need is some sort of flush so that Google ingests it.
https://developers.google.com/amp/cache/update-cache#update-rsa-keys states that to update the key, we can also ping
https://example-com.<cache.updateCacheApiDomainSuffix>/r/s/example.com/.well-known/amphtml/apikey.pub
which in our case should be https://www-androidpolice-com.cdn.ampproject.org/v/s/www.androidpolice.com/.well-known/amphtml/apikey.pub, but that's a 404.I tried joining https://amphtml.slack.com to ask the questions, but it seems to be only for @google.com users. Found https://bit.ly/amp-slack-signup and submitted a request. Hopefully that's still the right way to get in.
Finally, the request to dump cache I'm trying to make is something like
https://www-androidpolice-com.cdn.ampproject.org/update-cache/c/s/www.androidpolice.com/2019/08/31/android-police-now-supports-google-amp/%3famp?amp_action=flush&_ts=1567319166&_url_signature=Hkpfwk1YoewxjBAyaDEtIJ2EB9PWqBY_CeuuICQKmaPkCZ56zKdE9ROoiWdYfWaE-iUJjp2bX_cyHXl4jOqAkeKXeoJNjXwISSohPz_6E7nB4e94iLPxEGojDsEqvZ4ybSRBlsip1NNI5vXGBZKIPv-28GeoDtTGCyVxvPwnJRTn0POkQRfbWlM_hcLq9QlfVqV9w9jjm2TJ6K7Vk3NnsEsFqtsZsAsBbjYUVwiuxnCFNgyIljs8izLxySkWV8Ks6Z5ESMqVTruhSinc1iHB-bRuFQYzvM8JoiS9KoiWWRg4RgDHjNs2VKTx88kescVKgxl5BvwvgyOxKG7J0xAmK1
, but it returnsPresumably, this points to an inability to read the key?
For AMP urls that end with
?amp
, do we need to send a request tohttps://example-com.<cache.updateCacheApiDomainSuffix>/update-cache/c/s/example.com/article%3famp?amp_action=flush...
orhttps://example-com.<cache.updateCacheApiDomainSuffix>/update-cache/c/s/example.com/article?amp&_action=flush...
?Regarding cache, do I understand it correctly that if we don't send a max-age cache-control header, the cache will never be updated, but if we do, it'll be updated once the max-age runs out without having to ping update-cache? Or do we still need to update-cache for every time we edit the content?
Thank you.
The text was updated successfully, but these errors were encountered: