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

IPFS Companion going on local gateway, but with wrong schema when in video #954

Closed
simonfoilen opened this issue Dec 28, 2020 · 5 comments
Closed
Assignees
Labels
need/analysis Needs further analysis before proceeding

Comments

@simonfoilen
Copy link

Browser Setup

  • OS: Linux Ubuntu 20.04.1 LTS
  • Browser: Chrome Version 87.0.4280.88 (Official Build) (64-bit)
  • IPFS Companion Version: 2.16.0
  • IPFS Companion has been reset to default preferences

What is working (direct link to the video)

Steps:

What is not working (when in a video tag)

Steps:

What is strange is that on the second call, it gets the right url to use, but on the third one, it decided to modify the url to HTTPS instead of keeping the HTTP.

thanks

@simonfoilen simonfoilen added the need/triage Needs initial labeling and prioritization label Dec 28, 2020
@jessicaschilling
Copy link
Contributor

@lidel Is this something you might be able to investigate when you're back? Thank you!

@jessicaschilling jessicaschilling added need/analysis Needs further analysis before proceeding and removed need/triage Needs initial labeling and prioritization labels Jan 4, 2021
@lidel
Copy link
Member

lidel commented Jan 21, 2021

Thank you for detailed bug report @provirus 👍

I was able to reproduce the bug and confirm it is limited to Chromium-based browsers.
The problem happens when x-ipfs-path header triggers redirect of a video src in Chromium.

Firefox 84.0.2 💚

2021-01-21--00-34-10

Chromium 88.0.4315.5 💔

2021-01-21--00-36-27

Further look into Chromium behavior revealed that our extension correctly redirects to http://, however Chromium seems to ignore scheme change for subresource and makes the final request with https://

2021-01-21--01-36-23


Initial thoughts

  • My intuition is that there is a bug in redirects made from blocking webRequest.onHeadersReceived API in Chromium.
    • Bad news: it is very unlikely that Google will fix it, because they want to remove this API anyway: What to do about Manifest V3 #666
    • There is a chance we might be able to fix this as a side effect of our collab with Igalia on unifying localhost behavior as trusted/secure context, but that would be incidental and has low probability.
  • Realistically, we may need to disable x-ipfs-path-based subresource redirect in webRequest.onHeadersReceived in Chromium, unless a creative hack can be found to salvage this type of requests.

Workaround

@provirus let us know if any of below is feasible.

For users

If you want a quick fix as a Companion user, either toggle IPFS for this specific website via main menu:

2021-01-21--01-53-46

or go to Companion Preferences and disable header detection globally:

2021-01-21--01-52-06

For website admin

If you are the owner of https://cdn.foilen.com:

  • consider removing x-ipfs-path for now, to fix the immediate problem for all Companion users
  • add DNSLink for fra.cdn.foilen.com (it is missing for fra subdomain, only cdn.foilen.com has valid one)

@simonfoilen
Copy link
Author

Hi,
thanks for testing it.

If you want a quick fix as a Companion user, either toggle IPFS for this specific website via main menu

That is what I did in the meantime.

I reenabled it for fun and actually, it is now working correctly. I am checking the versions:

  • Browser: Chrome Version 87.0.4280.141 (Official Build) (64-bit)
  • IPFS Companion Version: 2.17.1

So, both versions changed and now all is good. I must be lucky :)

add DNSLink for fra.cdn.foilen.com (it is missing for fra subdomain, only cdn.foilen.com has valid one)

Actually, I didn't put one since all of them are all serving /ipns/cdn.foilen.com . There is no need for regional difference when on IPFS.


Thinking about it, maybe the fix is because now it can use the DNSLink for cdn.foilen.com instead of waiting for the X-Ipfs-Path since cdn.foilen.com is not returning any X-Ipfs-Path (the regional ones are returning X-Ipfs-Path) , but the url that it downloads is http://127.0.0.1:8080/ipns/cdn.foilen.com/foilen/HandBrake%20-%20Transcoder%20une%20video.mp4 (so the one with the cdn.foilen.com domain)
I am talking about the root cause of that other issue about resolving DNSLink: #953

thanks again

@lidel
Copy link
Member

lidel commented Jan 21, 2021

add DNSLink for fra.cdn.foilen.com (it is missing for fra subdomain, only cdn.foilen.com has valid one)

Actually, I didn't put one since all of them are all serving /ipns/cdn.foilen.com . There is no need for regional difference when on IPFS.

If you expose x-ipfs-path header, a DNSLink should also be there. It would not hurt :)
FYSA DNSLink-based redirects happen before header-based redirects, so this issue would probably not happen in the first place.

Anyway, glad this helped.

@simonfoilen
Copy link
Author

added it to my regional host names as well then. That could also be good if someone bookmarked the redirection.
Thanks for the suggestion :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/analysis Needs further analysis before proceeding
Projects
None yet
Development

No branches or pull requests

3 participants