From 5e84225535a733ece03a48281fd96b360436a2a2 Mon Sep 17 00:00:00 2001 From: Marcin Rataj <lidel@lidel.org> Date: Mon, 29 Jul 2024 20:43:16 +0200 Subject: [PATCH 1/3] fix: clarify cache-control of generated html --- src/http-gateways/path-gateway.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/http-gateways/path-gateway.md b/src/http-gateways/path-gateway.md index 51d75f09..d97569d4 100644 --- a/src/http-gateways/path-gateway.md +++ b/src/http-gateways/path-gateway.md @@ -426,8 +426,12 @@ Returned directive depends on requested content path and format: - `Cache-Control: public, max-age=29030400, immutable` MUST be returned for every immutable resource under `/ipfs/` namespace. + - Generated `/ipfs/` responses such as UnixFS directory listings are not + byte-for-byte immutable and SHOULD have a meaningful expiration that allows + for generated responses to be updated over time. Suggested value is one week: + `public, max-age=604800, stale-while-revalidate=2678400`. -- `Cache-Control: public, max-age=<ttl>` SHOULD be returned for mutable +- `Cache-Control: public, max-age=<ttl>, stale-while-revalidate=2678400` SHOULD be returned for mutable resources under `/ipns/{id-with-ttl}/` namespace; `max-age=<ttl>` SHOULD indicate remaining TTL of the mutable pointer such as :cite[ipns-record] or DNSLink TXT record. From d3cdb717b0301a2a09f06c03e6e3ab149b2acae8 Mon Sep 17 00:00:00 2001 From: Marcin Rataj <lidel@lidel.org> Date: Mon, 29 Jul 2024 21:15:43 +0200 Subject: [PATCH 2/3] chore(gw): allow best-effort cache-control on missing ttl --- src/http-gateways/path-gateway.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/http-gateways/path-gateway.md b/src/http-gateways/path-gateway.md index d97569d4..6db247c6 100644 --- a/src/http-gateways/path-gateway.md +++ b/src/http-gateways/path-gateway.md @@ -437,7 +437,8 @@ Returned directive depends on requested content path and format: TXT record. - Implementations MAY place an upper bound on any TTL received, as noted in Section 8 of :cite[rfc2181]. - - If TTL value is unknown, implementations SHOULD not send a `Cache-Control` + - If TTL value is unknown, implementations MAY send a best-effort `Cache-Control` + informing caches and CDNs how long a stale response is acceptable. - No matter if TTL value is known or not, implementations SHOULD always send a [`Last-Modified`](#last-modified-response-header) header with the timestamp of the record resolution. From 7d1e29da7e66b3b2ceac685259956ae37995a8ff Mon Sep 17 00:00:00 2001 From: Marcin Rataj <lidel@lidel.org> Date: Thu, 21 Nov 2024 19:40:51 +0100 Subject: [PATCH 3/3] chore: clarify week is floor, not ceiling suggestion --- src/http-gateways/path-gateway.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http-gateways/path-gateway.md b/src/http-gateways/path-gateway.md index 6db247c6..440b7528 100644 --- a/src/http-gateways/path-gateway.md +++ b/src/http-gateways/path-gateway.md @@ -428,7 +428,7 @@ Returned directive depends on requested content path and format: every immutable resource under `/ipfs/` namespace. - Generated `/ipfs/` responses such as UnixFS directory listings are not byte-for-byte immutable and SHOULD have a meaningful expiration that allows - for generated responses to be updated over time. Suggested value is one week: + for generated responses to be updated over time. Suggested value is at least one week: `public, max-age=604800, stale-while-revalidate=2678400`. - `Cache-Control: public, max-age=<ttl>, stale-while-revalidate=2678400` SHOULD be returned for mutable