brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.84k stars 2.33k forks source link

IPFS redirection support breaks IPFS node Web UI #18355

Open realandrew opened 3 years ago

realandrew commented 3 years ago

Description

When trying to visit the Web UI for an IPFS node I have running on a remote system in my LAN (in my case http://192.168.0.204:9501/ipfs/bafybeiflkjt66aetfgcrgvv75izymd5kc47g6luepqmfq6zsf5w6ueth6y) since I have "Redirect IPFS resources to the configured IPFS gateway" turned on in my Brave settings it tries to redirect, which breaks the Web UI, I understand this looks the same as a normal IPFS gateway link and that's why it's redirected so I think one solution here would be to allow the user to specify URLs that are exempt from being redirected. It might make sense to have exemptions for the DNSLink redirection as well (I have my toggled off only because there's 1 website I use that has a login page that breaks on IPFS, and since I can't exempt it the only option is to turn off DNSLink redirection altogether).

Steps to Reproduce

  1. Have an IPFS node running somewhere on your local network
  2. Try to access the WebUI from within Brave with gateway redirection turned on

Actual result:

The bug should occur and Web UI will say "Could not connect to the IPFS API" but will work fine using a different browser or with gateway redirection turned off.

Expected result:

IPFS Web UI loads fine.

Reproduces how often:

Easily reproduced

Brave version (brave://version info)

Brave | 1.29.81 Chromium: 93.0.4577.82 (Official Build) (64-bit) Revision | e3a25d9b9e2d0b728e045ec87c0aa4942aa46e4e-refs/branch-heads/4577@{#1237} OS | Windows 10 OS Version 2009 (Build 19043.1237)

Version/Channel Information:

Other Additional Information:

Miscellaneous Information:

It should be noted accessing the Web UI for Brave's local IPFS node does not have this problem (go to brave://ipfs-internals/ and click "my node" to access the UI), implying Brave is already using some sort of exemption list under the hood which could be extended with a user-configurable list to solve this issue (unless it's just exempting 127.0.0.1 URLs).

lidel commented 2 years ago

Agree. At the very least, it is sensible to exclude https://en.wikipedia.org/wiki/IPv4#Private_networks from redirect logic.

@spylogsster mind adding ipfs labbel?