Skip to content

feat(gateway): guard the resolver properties that published sites now rely on - #125

Merged
ehsan6sha merged 1 commit into
mainfrom
feat/relative-asset-guards
Sep 12, 2026
Merged

feat(gateway): guard the resolver properties that published sites now rely on#125
ehsan6sha merged 1 commit into
mainfrom
feat/relative-asset-guards

Conversation

@ehsan6sha

Copy link
Copy Markdown
Member

Companion to pinning-service#94, which makes generated sites gateway-agnostic by referencing assets document-relatively (../<cid>) instead of naming a gateway.

Why these guards

That change turns two properties of the resolver Worker into load-bearing infrastructure for every site's images:

  1. The redirect target must keep its trailing slash. From /ipfs/<page>/ the reference resolves to /ipfs/<cid>; from /ipfs/<page> it resolves to /<cid> and 404s. The site still renders — an injected fallback chain recovers the image — but it is no longer served by the gateway the visitor chose.
  2. It must redirect, never proxy. If the Worker served the page itself, the document URL would be fxfiles.top/w/<name> and ../<cid> would resolve back into the Worker as a bogus IPNS name instead of reaching a gateway.

Neither would fail loudly. A change dropping the slash would look fine in every existing test and quietly stop every site from following its gateway.

fx.land removed from the picker

It serves a "content withheld" interstitial before HTML in a browser (measured 2026-09-12 — curl bypasses it, which is exactly why an earlier check waved it through). Poor thing to put in front of someone opening a shared website, and almost certainly why it stopped being the default originally.

Not removed entirely: raw assets are served normally (correct image/jpeg, no interstitial), so it stays as the second entry in the published fallback chain and as an accepted ?gw=fx key — a site is then never at the mercy of one third party. Filebase is the only preset offered.

Testing

35 worker · 28 gateway-helper (one new: fx absent from the picker, still resolving as a key) · 1079 Flutter · analyzer clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AwMWmCivEpYTmmzzmjSTAf

… rely on

Companion to pinning-service#94, which makes generated sites gateway-agnostic by
referencing assets DOCUMENT-RELATIVELY (`../<cid>`) instead of naming a gateway.
That turns two properties of this Worker into load-bearing infrastructure for
every site's images, so they are pinned by tests rather than left to chance:

1. The redirect target must keep its TRAILING SLASH. From `/ipfs/<page>/` the
   reference resolves to `/ipfs/<cid>`; from `/ipfs/<page>` it resolves to
   `/<cid>` and 404s. The site still renders -- an injected fallback chain
   recovers the image from an absolute gateway -- but it is no longer served by
   the gateway the visitor actually chose.

2. It must REDIRECT, never proxy. If this Worker ever served the page itself,
   the document URL would be `fxfiles.top/w/<name>` and `../<cid>` would resolve
   back into the Worker as a bogus IPNS name instead of reaching a gateway.

Neither would fail loudly. A change that dropped the slash would look fine in
every existing test and quietly stop every site from following its gateway.

ALSO: fx.land is removed from the gateway picker.

It serves a "content withheld" interstitial before HTML in a browser -- measured
2026-09-12; curl bypasses it, which is exactly why an earlier check waved it
through. That is a poor thing to put in front of someone opening a shared
website, and is almost certainly why it stopped being the default originally.

It is NOT removed entirely: raw assets are served normally (correct image/jpeg,
no interstitial), so it stays as the second entry in the published fallback
chain and as an accepted `?gw=fx` key. A site is then never at the mercy of a
single third party. Filebase is the only preset offered.

Tests: 35 worker, 28 gateway-helper (one new asserting fx is absent from the
picker while still resolving as a key), 1079 Flutter, analyzer clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AwMWmCivEpYTmmzzmjSTAf
@ehsan6sha
ehsan6sha merged commit 7d18036 into main Sep 12, 2026
2 of 3 checks passed
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.

1 participant