diff --git a/src/http-gateways/path-gateway.md b/src/http-gateways/path-gateway.md index 5de0e604..5088728c 100644 --- a/src/http-gateways/path-gateway.md +++ b/src/http-gateways/path-gateway.md @@ -520,10 +520,16 @@ This header is more widely used in [SUBDOMAIN_GATEWAY.md](./SUBDOMAIN_GATEWAY.md Gateway MUST return a redirect when a valid UnixFS directory was requested without the trailing `/`, for example: -- response for `https://ipfs.io/ipns/en.wikipedia-on-ipfs.org/wiki` - (no trailing slash) will be HTTP 301 redirect with +- response for UnixFS directory at `https://example.com/ipns/en.wikipedia-on-ipfs.org/wiki` + (no trailing slash) MUST be HTTP 301 redirect with `Location: /ipns/en.wikipedia-on-ipfs.org/wiki/` +This normalization is required for directory-based relative links +and security scopes such as Service Worker registrations to work correctly. +It also ensures the same behavior on path gateways (`https://example.com/ipfs/cid/` with trailing `/`) +and origin-isolated HTTP contexts `https://cid.ipfs.dweb.link` +or non-HTTP URLs like `ipfs://cid`, where empty path component is implicit `/`. + ### `X-Ipfs-Path` (response header) Used for HTTP caching and indicating the IPFS address of the data.