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)!: no duplicate payload during subdomain redirects #326

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

hacdias
Copy link
Member

@hacdias hacdias commented May 31, 2023

This is based on top of #315 since that PR also has to deal with this.

Right now we send the content body on requests that include redirection. This decision was made a long time ago to ensure that tools, such as curl and wget would be able to fetch on localhost and not be redirected to subdomains that may not work with them. However, considering the published gateway standards we have, this may be a legacy thing we can clean up.

Unfortunately, we have sharness and conformance tests that check for the body on redirection requests. Those will need to be updated in order for this to work.

cc @lidel

@hacdias hacdias changed the base branch from main to issue/307 May 31, 2023 13:50
@hacdias hacdias changed the title feat(gateway): preview dag-cbor/-json with links feat(gateway)!: do not send body when redirecting May 31, 2023
@codecov

This comment was marked as off-topic.

@hacdias hacdias self-assigned this May 31, 2023
Base automatically changed from issue/307 to main May 31, 2023 15:14
@lidel
Copy link
Member

lidel commented May 31, 2023

@hacdias Yes, this is expected -- these tests are there to ensure we don't change this silently until we are ready.

I think we are ready, we should stop doing this and remove it from conformance, don't want others to reimplement this hack.
It is wasting bandwidth and/or increasing latency on clients that are not able to drop connection after receiving Location header.

  • Update sharness and conformance to no longer return body on redirects
  • Just in case anyone relies on old behavior, the body should include a text/plain or text/html message informing user about redirect and URL of the new location. This way if any automation fails, it will be easy for people to debug and fix (Location header is often not logger and if body is empty, nothing wil show up)

@hacdias hacdias force-pushed the just-redirect branch 2 times, most recently from 0a177e9 to 7cd8aee Compare June 1, 2023 09:10
@hacdias
Copy link
Member Author

hacdias commented Jun 1, 2023

@lidel:

@hacdias hacdias marked this pull request as ready for review June 1, 2023 10:17
@hacdias hacdias requested a review from lidel as a code owner June 1, 2023 10:17
lidel pushed a commit to ipfs/gateway-conformance that referenced this pull request Jun 1, 2023
@BigLep BigLep mentioned this pull request Jun 1, 2023
5 tasks
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, thank you for cleaning this up! ❤️
I'm merging and bubbling up to ipfs/kubo#9913

@lidel lidel merged commit 1464d19 into main Jun 1, 2023
@lidel lidel deleted the just-redirect branch June 1, 2023 21:59
@lidel lidel changed the title feat(gateway)!: do not send body when redirecting fix(gateway)!: no duplicate payload during subdomain redirects Jun 1, 2023
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
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants