feat(gateway): guard the resolver properties that published sites now rely on - #125
Merged
Conversation
… 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
/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.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=fxkey — 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