Skip to content

Conversation

achingbrain
Copy link
Member

Pass redirect: 'follow' to @helia/verified-fetch when subdomain support is enabled, otherwise we send a 301 with no Location header.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

Pass `redirect: 'follow'` to `@helia/verified-fetch` when subdomain
support is enabled, otherwise we send a 301 with no `Location` header.
@achingbrain
Copy link
Member Author

achingbrain commented Apr 11, 2024

I'm not sure how to write a test for this because the e2e tests only have a single server config.

@SgtPooki presumably this will be covered by the conformance tests after #67?

@achingbrain achingbrain requested a review from SgtPooki April 11, 2024 06:44
@SgtPooki
Copy link
Member

presumably this will be covered by the conformance tests after #67?

Yea it should be covered by subdomain gateway conformance, though I don't think we will run gateway conformance against subdomains=disabled versions of this gateway?

@achingbrain
Copy link
Member Author

That's interesting, we have to turn off subdomains to get tiros to work (from what I can see), because the flow goes like:

  1. HTTP Gateway runs in a container with the name "ipfs"
  2. Browser requests http://ipfs/ipns/filecoin.io
  3. Browser is redirected to http://filecoin.io.ipns.ipfs
  4. Browser fails with net::ERR_NAME_NOT_RESOLVED

This is because Docker doesn't support wildcards in container aliases so can't resolve filecoin.io.ipns.ipfs 🙄

I'm guessing Kubo has subdomains off by default and we have it on (which is better) so Kubo doesn't need any extra config.

@achingbrain achingbrain merged commit b4531c0 into main Apr 11, 2024
@achingbrain achingbrain deleted the fix/follow-redirects-when-subdomains-disabled branch April 11, 2024 10:24
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.

2 participants