Skip to content

routing/http/server: add cache control#584

Merged
hacdias merged 6 commits intomainfrom
http-routing-cache-control
Mar 7, 2024
Merged

routing/http/server: add cache control#584
hacdias merged 6 commits intomainfrom
http-routing-cache-control

Conversation

@hacdias
Copy link
Member

@hacdias hacdias commented Mar 5, 2024

Cache-control for ipfs/someguy#26.

@hacdias hacdias requested a review from a team as a code owner March 5, 2024 14:32
@hacdias hacdias force-pushed the http-routing-cache-control branch from 8028221 to 3d98596 Compare March 5, 2024 14:33
@hacdias hacdias requested a review from lidel March 5, 2024 14:33
@hacdias hacdias self-assigned this Mar 5, 2024
@codecov
Copy link

codecov bot commented Mar 5, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 65.66%. Comparing base (97e347e) to head (3590def).

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #584      +/-   ##
==========================================
+ Coverage   65.64%   65.66%   +0.02%     
==========================================
  Files         207      207              
  Lines       25617    25656      +39     
==========================================
+ Hits        16815    16848      +33     
- Misses       7328     7335       +7     
+ Partials     1474     1473       -1     
Files Coverage Δ
routing/http/types/json/responses.go 50.81% <100.00%> (+5.36%) ⬆️
routing/http/server/server.go 69.68% <89.47%> (+2.04%) ⬆️

... and 9 files with indirect coverage changes

@hacdias hacdias force-pushed the http-routing-cache-control branch from 52243a2 to 2a18c58 Compare March 6, 2024 09:44
lidel added 4 commits March 7, 2024 00:31
While we are at adding cache-control, we should leverage
stale-while-revalidate hint, especially when we have useful results.

Adding Last-Modified also does not cost us anything, but allows
clients to benefit from caching proxies and CDNs in front of someguy
returning HTTP 304 when request includes If-Modified-Since.
this ensures proxies put in front of someguy will use
Accept from request in the cache key, and not mix
application/x-ndjson responses with application/json ones.
Copy link
Member

@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.

@hacdias i've pushed a few additional improvements which felt like low hanging fruits that will improve setups like our someguy deployment at https://delegated-ipfs.dev/routing/v1/, so would be good if you 👀 before merging.

If no concerns, feel free to merge and:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

3 participants