Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gateway): Cache-Control header for UnixFS directories on /ipfs #643

Merged
merged 3 commits into from
Jul 29, 2024

Conversation

lidel
Copy link
Member

@lidel lidel commented Jul 29, 2024

Continuing from #639

acejam and others added 2 commits July 26, 2024 16:51
Copy link

codecov bot commented Jul 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.87%. Comparing base (0190b70) to head (1e23bb2).

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #643      +/-   ##
==========================================
+ Coverage   59.75%   59.87%   +0.12%     
==========================================
  Files         238      238              
  Lines       29999    30004       +5     
==========================================
+ Hits        17926    17965      +39     
+ Misses      10450    10426      -24     
+ Partials     1623     1613      -10     
Files Coverage Δ
gateway/handler_unixfs_dir.go 65.88% <100.00%> (+1.03%) ⬆️

... and 11 files with indirect coverage changes

Copy link
Member Author

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, we will likely refine cache-control across all response types, but this is useful fix of a hot path (dir listings on /ipfs should benefit from wider cache window).

Related spec clarification in ipfs/specs#480

Digression:

  • max-age based on TTL for /ipns/{dnslink} is unrelated to this fix, but we may want to fix it sooner than later, as Gateway: Cache-Control, max-age=ttl, ETag for /ipns requests #329 (comment) impacts directory listings, and that is why this PR is limited to dir listings on /ipfs.
  • We are not married to the stale-while-revalidate value on IPNS, could adjust if needed (mutable conformance tests only care about max-age), but 1 month sounds more robust than a few days or a week, the intention is to avoid link rot, if http cache supports such wide window.

@lidel lidel marked this pull request as ready for review July 29, 2024 22:52
@lidel lidel requested a review from a team as a code owner July 29, 2024 22:52
@lidel lidel merged commit 96ceee6 into main Jul 29, 2024
16 checks passed
@lidel lidel deleted the pr-639 branch July 29, 2024 22:57
@lidel lidel mentioned this pull request Aug 5, 2024
32 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants