hsn10
June 4, 2024, 5:48pm
1
IPFS Companion in Brave doesn’t work . It is doing some redirects in circles if you type ipfs:// into address bar because brave sometimes rewrites address to ipfs://.
Second problem is plugin not redirecting at all to local node (internal or external) on IPFS enabled web site. I think it is related to really flaky detection of IPFS node running - Even if cube is green, companion still thinks that node is down if node doesn’t responding fast enough.
Brave should be demonstration of “future” tech browser with integrated IPFS but its currently worst IPFS experience ever.
opened 10:26PM - 13 Oct 23 UTC
kind/bug
P1
area/brave
This is MVP subset of https://github.com/ipfs/ipfs-companion/issues/1281 request… ed by the Brave team.
## Problem
Currently, Companion logic is clashing with Brave logic when both have redirects enabled.
>
> **Preconditions:**
>
> "Method to resolve IPFS resources": Brave local IPFS node
> "Automatically redirect requests for IPFS network resources to the configured gateway.": is ON
> IPFS daemon is started, but repository is cleaned
> Network access is blocked
>
> **Steps:**
> 1. You try to open the address: https://dweb.link/ipfs/bafkreiedqfhqvarz2y4c2s3vrbrcq427sawhzbewzksegopavnmwbz4zyq
> 2. Brave tries to redirect request throug the local node:
> https://localhost:45008/ipfs/bafkreiedqfhqvarz2y4c2s3vrbrcq427sawhzbewzksegopavnmwbz4zyq
>
> **Expected results:**
> The request: https://localhost:45008/ipfs/bafkreiedqfhqvarz2y4c2s3vrbrcq427sawhzbewzksegopavnmwbz4zyq
> is failed, infobar with proposition to load original URL (i.e. from step1) is shown
>
> **Actual result:**
> In case of IPFS Companion is enabled: It redirects us to ipfs://bafkreiedqfhqvarz2y4c2s3vrbrcq427sawhzbewzksegopavnmwbz4zyq as well,
> and redirect happens again once we try to redirect to original URL.
> So we never can redirect back to original URL
> Sometimes I even observed redirect loop (edited)
>
## Proposed fix
The provisional fix is to periodically check if all below are true:
- Companion's global redirect is enabled
- Companion's backend type is Kubo RPC provided by Brave
- Brave settings have redirect enabled (read via `chrome.ipfs.getSettings`)
If true, we want to
- store Brave setting and timestamp for later
- disable the Brave redirects (via `chrome.ipfs.setGatewayFallbackEnabled(false)` and `chrome.ipfs.setAutoRedirectToConfiguredGatewayEnabled(false)`), ensuring only Companion ones are executed