Skip to content

Conversation

@achingbrain
Copy link
Member

@achingbrain achingbrain commented Nov 26, 2025

Browsers will always send an Accept header so if present the format request param should take priority, not the other way round as the spec currently says.

Things to land before ratifying (merging) this IPIP

@achingbrain achingbrain force-pushed the feat/ipip-accept-vs-format branch from 8c22f1a to f76b2d5 Compare November 26, 2025 16:36
Browsers will always send an Accept header so if present the format
request param should take priority, not the other way round as the
spec currently says.
@achingbrain achingbrain force-pushed the feat/ipip-accept-vs-format branch from a0ec721 to 824cf89 Compare November 26, 2025 16:37
@github-actions
Copy link

github-actions bot commented Nov 26, 2025

🚀 Build Preview on IPFS ready

lidel added 2 commits December 1, 2025 21:31
- clarify format is URL query param, Accept is HTTP header
- expand Compatibility with HTTP caching rationale
- add Security and Alternatives sections
- update precedence rule in both path-gateway and trustless-gateway
update car-version, car-order, car-dups to match IPIP-0523:
URL query parameter SHOULD take precedence over Accept header
lidel added a commit to ipfs/boxo that referenced this pull request Dec 1, 2025
…pt header

this change simplifies precedence rules by making the ?format= URL query
parameter always take priority over the Accept HTTP header when both are
present.

in practice, this is largely compatible with existing browser use cases
since browsers send Accept headers with wildcards which were already
treated as non-specific. prioritizing ?format= also ensures deterministic
HTTP caching behavior, protecting against CDNs that comingle different
response types under the same cache key.

the only breaking change is for edge cases where a client sends both a
specific Accept header and a different ?format= value. previously Accept
would win, now ?format= wins. this scenario is rare and arguably
represents client misconfiguration. when detected, gateway returns HTTP
400 to signal the ambiguity.

specs: ipfs/specs#523
tests: ipfs/gateway-conformance#252
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.

Thank you for cleaning this up. This is def. a technical debt we asccumulated by adding features over time. Work on Service Worker gateway makes it a good time to do this.

lgtm, added some meat to missing/empty sections

GO implementation is ready – details in ipfs/gateway-conformance#252 (review) (if no concerns, we will merge later this week and ship in Kubo 0.40)

Users will be able to use the `format` URL query parameter to control the
response type of requests made from browser address bars.

### Compatibility
Copy link
Member

Choose a reason for hiding this comment

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

ℹ️ @achingbrain fyi I've expanded the Compatibility section. While formally this is a breaking change, in practice boxo/gateway already had an escape hatch in customResponseFormat which prioritized format if Accept has a wildcard or used something other than raw, car or ipns-record

(imo this is good news, means IPIP is actually cleaning up and formalizing real world behavior in browsers)

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.

3 participants