-
Notifications
You must be signed in to change notification settings - Fork 237
IPIP-0523: Prefer format request param over Accept header #523
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
base: main
Are you sure you want to change the base?
Conversation
8c22f1a to
f76b2d5
Compare
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.
a0ec721 to
824cf89
Compare
🚀 Build Preview on IPFS ready
|
- 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
…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
There was a problem hiding this 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 |
There was a problem hiding this comment.
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)
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