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
How/why AMPs might break when viewed on a cache #7430
How/why AMPs might break when viewed on a cache #7430
Conversation
This is good. Adding: I wonder if we can also add a check for proper CORS settings? |
spec/amp-cache-debugging.md
Outdated
@@ -0,0 +1,24 @@ | |||
# AMP Cache Debugging | |||
|
|||
**Why is my doc broken on the AMP cache?** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe phrase "on the AMP cache" as "when served from an AMP cache" instead.
Would be good to phrase throughout as general AMP caches, rather than "the" AMP cache, so the guidelines aren't Google-specific
spec/amp-cache-debugging.md
Outdated
|Web fonts do not appear (fallback fonts are used)|Fonts served with incorrect MIME type|Specify an [acceptable MIME type](https://github.com/ampproject/amphtml/blob/master/spec/amp-cache-guidelines.md#mime-types-for-fonts) for fonts| | ||
|Web fonts do not appear (fallback fonts are used)|Cache not whitelisted by font provider|Contact font provider and ask them to whitelist [all caches](https://github.com/ampproject/amphtml/blob/master/spec/amp-cors-requests.md#cors-security-in-amp)| | ||
|Assets (e.g. fonts and images) do not appear (**HTTP origins only**)|Document uses protocol-relative URLs|Switch to absolute URLs (that is, `http://www.site.com/doc/amp`, not `//www.site.com/doc/amp`)| | ||
|Assets (e.g. fonts and images) do not appear|Cache is unable to access assets|Ensure the Google crawler is able to access your assets and is not blocked by `robots.txt`, IP address, or user agent, etc. ([List of user agents used by Google's crawler](https://support.google.com/webmasters/answer/1061943?hl=en).)| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment regarding making this not Google-specific. The language is straightforward to change: "Ensure that AMP crawlers are able...". Then, for the list of user agents used by these crawlers, there could be a grid of AMP caches and their corresponding user agents?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, switched to cache-neutral language in 24f85cc.
spec/amp-cache-debugging.md
Outdated
that can be problematic. | ||
|
||
If a particular document appears and behaves as expected on your origin, but not | ||
when viewed via the cache (how to map origin URLs to [Google's AMP Cache](https://developers.google.com/amp/cache/overview#amp-cache-url-format)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dknecht Is there an equivalent Cloudflare document?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not at the moment. We have in our backlog.
We are actually following the same format. I am not sure if there is comparable doc on am-project.org.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@irtefa fyi
spec/amp-cache-debugging.md
Outdated
|Web fonts do not appear (fallback fonts are used)|Fonts served with incorrect MIME type|Specify an [acceptable MIME type](https://github.com/ampproject/amphtml/blob/master/spec/amp-cache-guidelines.md#mime-types-for-fonts) for fonts| | ||
|Web fonts do not appear (fallback fonts are used)|Cache not whitelisted by font provider|Contact font provider and ask them to whitelist [all caches](https://github.com/ampproject/amphtml/blob/master/spec/amp-cors-requests.md#cors-security-in-amp)| | ||
|Assets (e.g. fonts and images) do not appear (**HTTP origins only**)|Document uses protocol-relative URLs|Switch to absolute URLs (that is, `http://www.site.com/doc/amp`, not `//www.site.com/doc/amp`)| | ||
|Assets (e.g. fonts and images) do not appear|Cache is unable to access assets|Ensure the cache is able to access your assets and is not blocked by `robots.txt`, IP address, or user agent, etc. (List of user agents used by [Google's crawler](https://support.google.com/webmasters/answer/1061943?hl=en).)| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dknecht Anything that should be added for Cloudflare here?
spec/amp-cache-debugging.md
Outdated
|Web fonts do not appear (fallback fonts are used)|Fonts served with incorrect MIME type|Specify an [acceptable MIME type](https://github.com/ampproject/amphtml/blob/master/spec/amp-cache-guidelines.md#mime-types-for-fonts) for fonts| | ||
|Web fonts do not appear (fallback fonts are used)|Cache not whitelisted by font provider|Contact font provider and ask them to whitelist [all caches](https://github.com/ampproject/amphtml/blob/master/spec/amp-cors-requests.md#cors-security-in-amp)| | ||
|Assets (e.g. fonts and images) do not appear (**HTTP origins only**)|Document uses protocol-relative URLs|Switch to absolute URLs (that is, `http://www.site.com/doc/amp`, not `//www.site.com/doc/amp`)| | ||
|Assets (e.g. fonts and images) do not appear|Cache is unable to access assets|Ensure the cache is able to access your assets and is not blocked by `robots.txt`, IP address, or user agent, etc. (List of user agents used by [Google's crawler](https://support.google.com/webmasters/answer/1061943?hl=en).)| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caches should not (and do not) respect robots.txt for user invoked requests, so this should not be an issue.
The IP based blocking can, indeed, be an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove reference to robots.txt
in d8df74e.
spec/amp-cache-debugging.md
Outdated
|
||
|Symptom|Issue|Solution| | ||
|---|---|---| | ||
|Web fonts do not appear (fallback fonts are used)|Fonts served with incorrect MIME type|Specify an [acceptable MIME type](https://github.com/ampproject/amphtml/blob/master/spec/amp-cache-guidelines.md#mime-types-for-fonts) for fonts| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same can also happen with images. Either a non image/
mime type or the wrong mime type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adjusted doc to mention images in c1c054f.
A few other suggestion:
|
spec/amp-cache-debugging.md
Outdated
|
||
If a particular document appears and behaves as expected on your origin, but not | ||
when viewed via the cache (how to map origin URLs to [Google's AMP Cache](https://developers.google.com/amp/cache/overview#amp-cache-url-format)), | ||
first open the developer console in your browser, and ensure no errors or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the "developer console" the Chrome one? If so, please be specific - "Chrome DevTools console"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I was trying to be browser neutral but ended up being confusing--I've adjusted the language a bit in 5765a50. Should I also specifically call out Chrome?
spec/amp-cache-debugging.md
Outdated
|
||
If a particular document appears and behaves as expected on your origin, but not | ||
when viewed via the cache (how to map origin URLs to [Google's AMP Cache](https://developers.google.com/amp/cache/overview#amp-cache-url-format)), | ||
first open the developer console in your browser, and ensure no errors or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would read better if the "steps" were listed as bullets, so that it's easy to parse the info, like so:
If a particular document appears and behaves as expected on your origin, but not when viewed via the cache (how to map origin URLs to Google's AMP Cache), try the following:
- Validate that there are no errors or warnings for the AMP page by reviewing the Chrome DevTools console.
- Validate the structured data and AMP urls for the page by using the AMPBench tool.
- If you still have a problem, review the table below:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to point form in 5765a50.
@dknecht What's the distorted image problem you're referring to in #7430 (comment)? |
@ithinkihaveacat Every once in awhile the google cache and cloudflare cache preform an image optimization that make image break. I would suggest we merge this and. then improve from here. This doc is a great start. |
Thanks @ithinkihaveacat ! — LGTM as long as other reviewers agree |
Can we make this appear on our docs site? |
@cramforce - Yes, I can, in the debugging section. It'll have to be merged first, then I'll do some inclusion. Also, to be clear, are these instructions relevant to all caches, not just Google? |
spec/amp-cache-debugging.md
Outdated
@@ -0,0 +1,28 @@ | |||
# AMP Cache Debugging | |||
|
|||
**Why is my doc broken on an AMP cache?** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make this a heading level 2 (##
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 5a13ec8.
Ping @cramforce — LGTY? |
|Symptom|Issue|Solution| | ||
|---|---|---| | ||
|Web fonts do not appear (fallback fonts are used)|Cache not whitelisted by font provider|Contact font provider and ask them to whitelist [all caches](https://github.com/ampproject/amphtml/blob/master/spec/amp-cors-requests.md#cors-security-in-amp)| | ||
|Assets (e.g. fonts and images) do not appear #1 (**HTTP origins only**)|Document uses protocol-relative URLs|Switch to absolute URLs (that is, `http://www.site.com/doc/amp`, not `//www.site.com/doc/amp`)| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that the example should have an HTTPS protocol. And maybe use the domain https://www.example.com/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SchnWalter This item was specifically about HTTP origins, so http
is correct. Probably example.com
would be better but would really like to get this merged and so want to avoid making minor changes! (There's also another change I want to make to this doc soon (to mention https://cdn.ampproject.org/caches.json
)--I can make the example.com
change at the same time.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yes, http
, my bad.
Thanks for the great documentation!
Thanks all! @cramforce , @ithinkihaveacat , or @bpaduch — does one of you with merge access want to do the honors? |
Short document listing some common reasons why an AMP might behave differently when viewed on a cache versus the origin.
Probably not the right place for it, but couldn't think of a better one.
/cc @ericlindley-g