Skip to content

Commit 7564b07

Browse files
authored
Document more Google AMP SXG requirements. (#318)
- the signature header must be a subset of structured-headers - signed exchanges must not vary - the content must be text/html in utf-8 (either via content type or implicitly via the meta tag).
1 parent 7c76a6d commit 7564b07

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/cache_requirements.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ The Google AMP cache sets some requirements in addition to the ones set by the
1515
These include:
1616

1717
* The signed `fallback URL` must equal the URL at which the SXG was delivered.
18+
* The signature header must contain only:
19+
* One parameterised identifier.
20+
* Parameter values of type string, binary, or identifier.
1821
* The payload must be:
1922
* non-empty.
2023
* valid transformed AMP. The canonical definition of transformed AMP is the
@@ -37,11 +40,15 @@ These include:
3740
`manifest-src`, `referrer`, and `upgrade-insecure-requests` may be omitted
3841
or have any value
3942
* all other directives are disallowed
43+
* The signed `content-type` header must be present. Its media type must be
44+
`text/html`. Its `charset` parameter, if present, must case-insensitively
45+
equal `utf-8`.
4046
* The signed `link` header, if present, must look like [this](https://github.com/ampproject/amppackager/blob/e4bf0430ba152cfe82ccf063df92021dfc0f26a5/packager/signer/signer.go#L426)
4147
(the validation logic is currently very picky about its serialization); and
4248
have limits like [this](https://github.com/ampproject/amppackager/blob/e4bf0430ba152cfe82ccf063df92021dfc0f26a5/transformer/transformer.go#L177)
4349
(e.g. max 20 urls, rel=preload only, as=script|style only). URLs must be
4450
limited to `cdn.ampproject.org` and the allowlisted [font provider URLs](https://github.com/ampproject/amphtml/blob/b0ff92429923c86f3973009a84ff02f4f1868b4d/validator/validator-main.protoascii#L310).
51+
* There must not be a signed `variant-key-04` or `variants-04` header.
4552
* The signature's duration (expiry minus date) must be >= 4 days.
4653

4754
The above is an attempt at a complete list of SXG-related requirements, but it

0 commit comments

Comments
 (0)