Skip to content

Commit 81e437c

Browse files
authored
gateway: clarify why we normalize traling slash in dirs
1 parent 971db4c commit 81e437c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/http-gateways/path-gateway.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,16 @@ This header is more widely used in [SUBDOMAIN_GATEWAY.md](./SUBDOMAIN_GATEWAY.md
520520
Gateway MUST return a redirect when a valid UnixFS directory was requested
521521
without the trailing `/`, for example:
522522

523-
- response for `https://ipfs.io/ipns/en.wikipedia-on-ipfs.org/wiki`
524-
(no trailing slash) will be HTTP 301 redirect with
523+
- response for UnixFS directory at `https://example.com/ipns/en.wikipedia-on-ipfs.org/wiki`
524+
(no trailing slash) MUST be HTTP 301 redirect with
525525
`Location: /ipns/en.wikipedia-on-ipfs.org/wiki/`
526526

527+
This normalization is required for directory-based relative links
528+
and security scopes such as Service Worker registrations to work correctly.
529+
It also ensures the same behavior on path gateways (`https://example.com/ipfs/cid/` with trailing `/`)
530+
and origin-isolated HTTP contexts `https://cid.ipfs.dweb.link`
531+
or non-HTTP URLs like `ipfs://cid`, where empty path component is implicit `/`.
532+
527533
### `X-Ipfs-Path` (response header)
528534

529535
Used for HTTP caching and indicating the IPFS address of the data.

0 commit comments

Comments
 (0)