Skip to content

Commit c9993b8

Browse files
authored
Cherry-pick README fixes into releases. (#344)
1 parent 73dec5d commit c9993b8

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

README.md

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# AMP Packager
22

3-
AMP Packager is a tool to [improve AMP
4-
URLs](https://www.ampproject.org/latest/blog/developer-preview-of-better-amp-urls-in-google-search).
5-
By running it in a proper configuration, web publishers may (eventually) have
6-
origin URLs appear in AMP search results.
3+
AMP Packager is a tool to [improve AMP URLs](https://blog.amp.dev/2018/11/13/developer-preview-of-better-amp-urls-in-google-search/)
4+
by [serving AMP using Signed Exchanges](https://amp.dev/documentation/guides-and-tutorials/optimize-and-measure/signed-exchange/).
5+
By running it in a proper configuration, web publishers enable origin URLs to
6+
appear in AMP search results.
77

88
The AMP Packager works by creating [Signed HTTP
99
Exchanges (SXGs)](https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html)
1010
containing AMP documents, signed with a certificate associated with the origin,
11-
with a maximum lifetime of 7 days. In the future, the [Google AMP
12-
Cache](https://www.ampproject.org/docs/fundamentals/how_cached) will fetch,
11+
with a maximum lifetime of 7 days. The [Google AMP
12+
Cache](https://amp.dev/documentation/guides-and-tutorials/learn/amp-caches-and-cors/how_amp_pages_are_cached/) will fetch,
1313
cache, and serve them, similar to what it does for normal AMP HTML documents.
1414
When a user loads such an SXG, Chrome validates the signature and then displays
1515
the certificate's domain in the URL bar instead of `google.com`, and treats the
@@ -18,6 +18,8 @@ web page as though it were on that domain.
1818
The packager is an HTTP server that sits behind a frontend server; it fetches
1919
and signs AMP documents as requested by the AMP Cache.
2020

21+
As an alternative to running the packager, you can sign up for one of the SXG [service providers](https://github.com/ampproject/amppackager/wiki/Service-Providers).
22+
2123
## Packager/Signer
2224

2325
### How to use
@@ -102,6 +104,10 @@ For now, productionizing is a bit manual. The minimum steps are:
102104
2. If the URL points to an AMP page and the `AMP-Cache-Transform` request
103105
header is present, rewrite the URL by prepending `/priv/doc` and forward
104106
the request.
107+
108+
NOTE: If using nginx, prefer using `proxy_pass` with `$request_uri`,
109+
rather than using `rewrite`, as in [this PR](https://github.com/Warashi/try-amppackager/pull/3),
110+
to avoid percent-encoding issues.
105111
3. If at all possible, don't send URLs of non-AMP pages to `amppkg`; its
106112
[transforms](transformer/) may break non-AMP HTML.
107113
4. DO NOT forward `/priv/doc` requests; these URLs are meant to be
@@ -121,19 +127,21 @@ For now, productionizing is a bit manual. The minimum steps are:
121127
restart amppkg (per
122128
[#93](https://github.com/ampproject/amppackager/issues/93)).
123129
7. Keep amppkg updated from `releases` (the default branch, so `go get` works)
124-
about every ~2 months. The details of this release cadence are still being
125-
worked out, but they will be signaled by Googlebot changing its
126-
`AMP-Cache-Transform` header from `google;v=N` to `google;v=N..{N+1}` and
127-
then ~2 months later to `google;v={N+1}`. (Or perhaps Google will always
128-
allow at least 2 versions; TBD.) You can use [various
129-
tools](https://stackoverflow.com/questions/9845655/how-do-i-get-notifications-for-commits-to-a-repository)
130-
to subscribe to `releases`.
130+
about every ~2 months. The [wg-caching](https://github.com/ampproject/wg-caching)
131+
team will release a new version approximately this often. Soon after each
132+
release, Googlebot will increment the version it requests with
133+
`AMP-Cache-Transform`. Googlebot will only allow the latest 2-3 versions
134+
(details are still TBD), so an update is necessary but not immediately.
135+
136+
To keep subscribed to releases, you can select "Releases only" from the
137+
"Watch" dropdown in GitHub, or use [various tools](https://stackoverflow.com/questions/9845655/how-do-i-get-notifications-for-commits-to-a-repository)
138+
to subscribe to the `releases` branch.
131139
132140
You may also want to:
133141
134142
1. Launch `amppkg` as a restricted user.
135143
2. Save its stdout to a rotated log somewhere.
136-
3. Use the [provided tools](https://www.ampproject.org/docs/fundamentals/validate)
144+
3. Use the [provided tools](https://amp.dev/documentation/guides-and-tutorials/learn/validation-workflow/validate_amp/)
137145
to verify that your published AMP documents are valid, for instance just
138146
before publication, or with a regular audit of a sample of documents. The
139147
[transforms](transformer/) are designed to work on valid AMP pages, and
@@ -208,6 +216,13 @@ This tool only packages AMP documents. To sign non-AMP documents, look at the
208216
commandline tools on which this was based, at
209217
https://github.com/WICG/webpackage/tree/master/go/signedexchange.
210218
219+
`<amp-install-serviceworker>` will fail inside of a signed exchange, due to a
220+
[Chrome limitation](https://bugs.chromium.org/p/chromium/issues/detail?id=939237). The
221+
recommendation is to ignore the console error, for now. This is because
222+
amp-install-serviceworker will still succeed in the unsigned AMP viewer case,
223+
and crawlers may reuse the contents of the signed exchange when displaying an
224+
AMP viewer to browser versions that don't support SXG.
225+
211226
## Local Transformer
212227
213228
The local transformer is a library within the AMP Packager that transforms AMP

0 commit comments

Comments
 (0)