Skip to content

Add Local Gateway URL setting for reverse proxy and Docker support#2486

Open
NiltonVolpato wants to merge 4 commits intoipfs:mainfrom
NiltonVolpato:fix/local-gateway-override
Open

Add Local Gateway URL setting for reverse proxy and Docker support#2486
NiltonVolpato wants to merge 4 commits intoipfs:mainfrom
NiltonVolpato:fix/local-gateway-override

Conversation

@NiltonVolpato
Copy link
Copy Markdown

Problem

When running Kubo in Docker or behind a reverse proxy, the WebUI generates incorrect gateway URLs (e.g., http://127.0.0.1:8080) for:

  • File downloads
  • Preview links
  • IPLD Explore page

This happens because the WebUI reads the gateway address from Kubo's config, which typically contains Docker-internal addresses like /ip4/0.0.0.0/tcp/8080 that get converted to 127.0.0.1:8080.

Fixes #2458

Solution

Adds a new "Local Gateway URL" setting that allows users to override the gateway URL used by the WebUI.

Priority order for gateway URL:

  1. User-configured Local Gateway URL (new)
  2. Gateway address from Kubo config
  3. Public Gateway (fallback)

Changes

  • Added LocalGatewayForm component in Settings
  • Added ipfsLocalGateway localStorage key
  • Modified selectGatewayUrl to check local override first
  • Sync setting to kuboGateway format for IPLD Explore page compatibility

How to Use

  1. Go to SettingsLocal Gateway
  2. Enter your actual gateway URL (e.g., https://ipfs.example.com)
  3. Submit - downloads and previews will now use this URL

Leave empty to use the existing behavior (auto-detect from Kubo config).

Testing

  • All Settings e2e tests pass
  • Manually tested with Docker + reverse proxy setup
  • Backward compatible - no change when setting is empty

Adds a new 'Local Gateway URL' setting that allows users to override
the gateway address from Kubo config. This is useful when:
- Running Kubo in Docker
- Accessing WebUI through a reverse proxy
- Accessing from a different host than where Kubo runs

The setting takes priority over the Kubo config gateway address.
When empty, the behavior falls back to the existing logic.

Fixes ipfs#2458
Ensures URLs like 'https://example.com/' and 'https://example.com'
are handled the same way, avoiding double slashes when constructing
paths like /ipfs/CID.
The ipld-explorer-components (Explore page) uses localStorage key
'kuboGateway' with {host, port, protocol} format. This change syncs
our 'ipfsLocalGateway' setting to that format so the Explore page
also uses the correct gateway URL.

Fixes Explore page using 127.0.0.1:8080 instead of custom gateway.
…flakiness

The e2e test uses getByText('Addresses') which matches any element
containing 'address' (case-insensitive). Changed 'gateway address' to
'gateway URL' in the description to avoid matching this query.
@NiltonVolpato NiltonVolpato requested a review from a team as a code owner April 1, 2026 16:18
@gammazero
Copy link
Copy Markdown

Triage: Will look at in conjunction with kubo v0.42.0

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.

Cannot set gateway address

2 participants