ipfs / helia-verified-fetch

A fetch-like API for obtaining verified & trustless IPFS CIDs on the web
https://npmjs.com/package/@helia/verified-fetch
Other
14 stars 4 forks source link

Cache-Control headers for mutable resources are wrong #17

Closed 2color closed 6 months ago

2color commented 6 months ago

Summary

When requesting resources with the ipns:// prefix, verifiedFetch returns the wrong Cache-Control header (specifically 'public, max-age=29030400, immutable') in the response object according to the specs.

This happens for both IPNS names and DNSLink

Suggestion

Set the Cache-Control headers according to the specs.

SgtPooki commented 6 months ago

we should also update https://github.com/ipfs/helia-verified-fetch/blob/4e6775cc8978e34fd9fa3b58a7bef90d64419906/packages/verified-fetch/src/utils/parse-url-string.ts#L113C31-L117

we will likely be updating resolveDNSLink to return TTL in addition to the string

related: https://github.com/ipfs/boxo/issues/329#issuecomment-1995236409