Skip to content

Commit 415158f

Browse files
committed
chore: editorial clarifications
1 parent d4eb5d5 commit 415158f

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

src/routing/http-routing-v1.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: >
44
Delegated routing is a mechanism for IPFS implementations to use for offloading
55
content routing, peer routing and naming to another process/server. This specification describes
66
an HTTP API for delegated routing of content, peers, and IPNS.
7-
date: 2023-08-31
7+
date: 2024-03-22
88
maturity: reliable
99
editors:
1010
- name: Gus Eggert
@@ -74,8 +74,12 @@ This API uses a standard version prefix in the path, such as `/v1/...`. If a bac
7474
#### Response Headers
7575

7676
- `Content-Type`: the content type of this response, which MUST be `application/json` or `application/x-ndjson` (see [streaming](#streaming)).
77-
- `Last-Modified`: the timestamp of the resolution.
78-
- `Cache-Control: public, max-age={TTL}`: cache TTL returned with the response. When present, it SHOULD be short for responses whose resolution ended in no results (e.g. 15 seconds), and MAY be longer for responses that have results (e.g. 5 minutes).
77+
- `Last-Modified`: the timestamp of the resolution, allowing CDNs and load balancers to support inexpensive update checks via `If-Modified-Since`
78+
- `Cache-Control: public, max-age={ttl}, public, stale-while-revalidate={max-ttl}, stale-if-error={max-ttl}`: meaningful cache TTL returned with the response.
79+
- The `max-age` SHOULD be shorter for responses whose resolution ended in no results (e.g. 15 seconds),
80+
and longer for responses that have results (e.g. 5 minutes).
81+
- Implementations SHOULD include `max-ttl`, set to the maximum cache window of the underlying routing system.
82+
For example, if Amino DHT results are returned, `stale-while-revalidate` SHOULD be set to `172800` (48h, which at the time of writing this specification, is the provider record expiration window).
7983
- `Vary: Accept`: allows intermediate caches to play nicely with the different possible content types.
8084

8185
#### Response Body
@@ -118,8 +122,12 @@ represented as a CIDv1 encoded with `libp2p-key` codec.
118122
#### Response Headers
119123

120124
- `Content-Type`: the content type of this response, which MUST be `application/json` or `application/x-ndjson` (see [streaming](#streaming)).
121-
- `Last-Modified`: the timestamp of the resolution.
122-
- `Cache-Control: public, max-age={TTL}`: cache TTL returned with the response. When present, it SHOULD be short for responses whose resolution ended in no results (e.g. 15 seconds), and MAY be longer for responses that have results (e.g. 5 minutes).
125+
- `Last-Modified`: the timestamp of the resolution, allowing CDNs and load balancers to support inexpensive update checks via `If-Modified-Since`
126+
- `Cache-Control: public, max-age={ttl}, public, stale-while-revalidate={max-ttl}, stale-if-error={max-ttl}`: meaningful cache TTL returned with the response.
127+
- When present, `ttl` SHOULD be shorter for responses whose resolution ended in no results (e.g. 15 seconds),
128+
and longer for responses that have results (e.g. 5 minutes).
129+
- Implementations SHOULD include `max-ttl`, set to the maximum cache window of the underlying routing system.
130+
For example, if Amino DHT results are returned, `stale-while-revalidate` SHOULD be set to `172800` (48h, which at the time of writing this specification, is the provider record expiration window).
123131
- `Vary: Accept`: allows intermediate caches to play nicely with the different possible content types.
124132

125133
#### Response Body
@@ -162,9 +170,12 @@ Each object in the `Peers` list is a record conforming to the [Peer Schema](#pee
162170
#### Response Headers
163171

164172
- `Etag`: a globally unique opaque string used for HTTP caching. MUST be derived from the protobuf record returned in the body.
165-
- `Cache-Control: public, max-age={TTL}`: cache TTL returned with :ref[IPNS Record] that has `IpnsEntry.data[TTL] > 0`. When present, SHOULD match the TTL value from the record. When record was not found (HTTP 404) or has no TTL (value is `0`), implementation SHOULD default to `max-age=60`. Implementations MAY also include other derivatives, such as `stale-while-revalidate` and `stale-if-error`.
173+
- `Cache-Control: public, max-age={ttl}, public, stale-while-revalidate={sig-ttl}, stale-if-error={sig-ttl}`: meaningful cache TTL returned with :ref[IPNS Record]
174+
- The `max-age` value in seconds SHOULD match duration from `IpnsEntry.data[TTL]`, if present and bigger than `0`. Otherwise, implementation SHOULD default to `max-age=60`.
175+
- Implementations SHOULD include `sig-ttl`, set to the remaining number of seconds the returned IPNS Record is valid.
166176
- `Expires: {SIGNATURE_EXPIRATION}`: header with time when the signature expires.
167-
- `Last-Modified`: with the timestamp of the resolution.
177+
- `Last-Modified`: the timestamp of cacheable resolution, allowing CDNs and load balancers to support inexpensive update checks via `If-Modified-Since`
178+
- `Vary: Accept`: allows intermediate caches to play nicely with the different possible content types.
168179

169180
#### Response Body
170181

0 commit comments

Comments
 (0)