fix(gateway)!: no duplicate payload during subdomain redirects#9913
Merged
fix(gateway)!: no duplicate payload during subdomain redirects#9913
Conversation
lidel
approved these changes
Jun 1, 2023
Member
There was a problem hiding this comment.
lgtm: I've added changelog and restored sharness test to confirm we have human-readable body.
Feel free to merge once boxo issue below is resolved.
@hacdias FYI I was not able to bubble up commit form boxo main branch to this PR today because ipfs/boxo#273 got merged first and introduced breaking changes:
$ go mod tidy
[..]
github.com/ipfs/kubo/core/commands imports
github.com/ipfs/boxo/provider/batched: package github.com/ipfs/boxo/provider/batched provided by github.com/ipfs/boxo at latest version v0.8.1 but not at required version v0.8.2-0.20230601215904-1464d19f3dba
[..]My understanding is we need to merge #9886 first, then rebase this PR and bumping boxo should work again.
2 tasks
8fbf39d to
17eb60d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
Based on ipfs/boxo#326 (comment):
We have made significant progress on writing specifications of the Path Gateway to Subdomain Gateway. It is time to remove hacks and unidiomatic HTTP behavior from Kubo's Gateway.
Previously, when performing redirects from Path gw to Subdomain gw, the response body would include the data. However, we have decided to discontinue this behavior for multiple reasons:
Firstly, it was identified that this approach was a hack and not a recommended practice, antipattern when looking at HTTP Semantics. To ensure consistency and discourage others from implementing this non-standard behavior, we have removed it from the gateway-conformance requirements too (fix: remove body check for subdomain redirection gateway-conformance#65).
Secondly,
ipfs.iodid not become a Subdomain Gateway. We've decoded to use a separate domain name for that,dweb.link. Thus, the redirect body hack was never deployed toipfs.io.Additionally, including the CID data in the response body was found to be inefficient and could lead to increased bandwidth usage and latency for clients unable to drop the connection after receiving the
Locationheader. In such cases, client would receive data twice.If any automation or process relies on the old behavior, the response body will now include a text/html message, whichwill inform the user about the redirect and provide the URL of the new location. This change makes it easier for legacy users to identify and troubleshoot any issues that may arise due to the modified behavior.
Overall, these changes aim to improve the performance, consistency, and maintainability of the Path Gateway to Subdomain Gateway redirects, while providing clear information to users in case of any unexpected behavior.