You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/routing/http-routing-v1.md
+18-7Lines changed: 18 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: >
4
4
Delegated routing is a mechanism for IPFS implementations to use for offloading
5
5
content routing, peer routing and naming to another process/server. This specification describes
6
6
an HTTP API for delegated routing of content, peers, and IPNS.
7
-
date: 2023-08-31
7
+
date: 2024-03-22
8
8
maturity: reliable
9
9
editors:
10
10
- name: Gus Eggert
@@ -74,8 +74,12 @@ This API uses a standard version prefix in the path, such as `/v1/...`. If a bac
74
74
#### Response Headers
75
75
76
76
-`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).
79
83
-`Vary: Accept`: allows intermediate caches to play nicely with the different possible content types.
80
84
81
85
#### Response Body
@@ -118,8 +122,12 @@ represented as a CIDv1 encoded with `libp2p-key` codec.
118
122
#### Response Headers
119
123
120
124
-`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).
123
131
-`Vary: Accept`: allows intermediate caches to play nicely with the different possible content types.
124
132
125
133
#### Response Body
@@ -162,9 +170,12 @@ Each object in the `Peers` list is a record conforming to the [Peer Schema](#pee
162
170
#### Response Headers
163
171
164
172
-`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.
166
176
-`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.
0 commit comments