Skip to content

Support for off cache AMP path #29296

@nainar

Description

@nainar

Introduction

Allow for developers to voluntarily opt out of a valid AMP page being in the cache. This will make personalization and cookie management much easier.

Motivation

AMP helps developers create performant sites by enabling the following:

  • Increased load time performance by serving pages from an AMP cache
  • Increased run time performance by performing resource prioritization.

In an effort to create pages that load instantaneously we push developers to create valid AMP pages that are served from the cache. Even as projects like Bento and launch, the end goal each developer is being forced to achieve is still to be served from the cache.

However, currently developers face a multitude of problems when their pages are served from the AMP cache:

  • Because the AMP cache is currently a different domain name to the origin, ITP2 on iOS blocks cookies. This makes it hard to start a session on Google’s AMP cache which transfers over to the origin.
  • Personalization and user authentication is hard to do on the cache when a cookie is set on the origin and then needs to be used when the user returns to the AMP cache in a later session.
  • In some cases brand don't want to be perceived as or actually have Google caches hold their data due to conflicting business rationale. While SxG does fix the perception issue, it does not solve the use case where a business might not want a competitor operating an AMP cache holding their data in a cache.
  • They do not have full control over how long content can stay in AMP caches. Currently content can be returned that is 1 month stale due to the stale-while-revalidate strategy.
    • This is a bug, it should motivate fixing the bug, not workarounds.
Solution Issues
Implement SxG SxG is only available on Chrome
Create invalid AMP pages Lose out on validation of AMP pages. Developers want the productivity of creating AMP pages and aren't doing anything not allowed by AMP's principles. However, they are being forced to create dirty or Bento AMP pages because they don't want the page to served from cache.
[FUTURE] Create Bento AMP pages. Lose out on validation of AMP pages. Developers want the productivity of creating AMP pages and aren't doing anything not allowed by AMP's principles. However, they are being forced to create dirty or Bento AMP pages because they don't want the page to served from cache.

Proposals

Any proposal should have the following:

  • Create a great user experience for AMP page visitors by having the page load fast.
  • Create a great development experience for developers using AMP.
  • Make analytics as easy to implement in AMP as non AMP pages.
  • Should have no effect on run time performance.
  • Give content creators more control on cache.

Opt out transformed AMP pages from AMP Caches

Pages transformed by the AMP Toolbox Optimizer are the closest we can get to mimicking Cache like performance on origin.
Allow developers to opt out transformed AMP pages out of the cache by marking the page as such:

Valid and cached AMP

Markup: <html amp> | <html ⚡>
How does this work:
AMP Pages are ingested as normal.
Result:
This page is intended to be served from the cache

###Valid and non cached AMP
Markup: <html amp="no-caching"> | <html ⚡no-cache>
How does this work:

  • Add the attribute to the validator
  • Detect the tag and skip exporting AMP related signals to AMP cache according to the above field
    Result:
    This page should pass the validator if the page contents are valid but should always be served from Origin.

Valid AMP that is cached if SxG is supported

Markup: <html amp="only-cache-if-sxg">
How does this work:

  • Add the attribute to the validator
  • Detect the tag (similar as above)
  • If not SxG, skip exporting AMP (similar as above)
  • If SxG, still export AMP related signals.
    Result:
    This page should pass the validator if the page contents are valid but should not be served from the Cache if SxG is not feature detected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions