Skip to content

Commit f216056

Browse files
authored
Merge pull request #451 from ipfs/web-redirects-clarifications
web-redirects: clarifications
2 parents 1d52d25 + 8832055 commit f216056

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

src/http-gateways/web-redirects-file.md

+22-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Web _redirects File Specification
33
description: >
44
Defines how URL redirects and rewrites can be implemented by adding rules to
55
a plain text file stored underneath the root CID of a website.
6-
date: 2023-01-28
6+
date: 2023-11-09
77
maturity: reliable
88
editors:
99
- name: Justin Johnson
@@ -75,7 +75,11 @@ For example:
7575

7676
This rule will redirect a URL like `/posts/06/15/2022/hello-world` to `/articles/2022/06/15/hello-world`.
7777

78-
### Splat
78+
Implementation MUST error when the same placeholder name is used more than once in `from`.
79+
80+
Implementation MUST allow the same placeholder name to be used more than once in `to`.
81+
82+
### Catch-All Splat
7983

8084
If a `from` path ends with an asterisk (i.e. `*`), the remainder of the `from` path is slurped up into the special `:splat` placeholder, which can then be injected into the `to` path.
8185

@@ -91,7 +95,7 @@ Splat logic MUST only apply to a single trailing asterisk, as this is a greedy m
9195

9296
### Comments
9397

94-
Any line beginning with `#` will be treated as a comment and ignored at evaluation time.
98+
Any line beginning with `#` MUST be treated as a comment and ignored at evaluation time.
9599

96100
For example:
97101

@@ -108,17 +112,29 @@ is functionally equivalent to
108112

109113
### Line Termination
110114

111-
Lines MUST be terminated by either `\n` or `\r\n`.
115+
Lines MUST be separated from each other by either `\n` or `\r\n`.
116+
117+
Termination of the last line in the file is optional.
118+
119+
### Whitespace Characters
120+
121+
Blank lines, leading and trailing whitespace characters like `\x20` (space) or
122+
`\t` (tab) MUST be ignored, aside from the line termination mentioned above.
112123

113124
### Max File Size
114125

115126
The file size MUST NOT exceed 64 KiB.
116127

117128
# Evaluation
118129

119-
## Subdomain or DNSLink Gateways
130+
## Same-Origin Requirement
131+
132+
Rules MUST only be evaluated in contexts where
133+
[Same-Origin](https://en.wikipedia.org/wiki/Same-origin_policy) isolation per
134+
root CID is possible.
120135

121-
Rules MUST only be evaluated when hosted on a Subdomain or DNSLink Gateway, so that we have [Same-Origin](https://en.wikipedia.org/wiki/Same-origin_policy) isolation.
136+
This requirement is fulfilled on a Subdomain or DNSLink HTTP Gateway,
137+
and also applies to a web browser with native `ipfs://` and `ipns://` scheme handler.
122138

123139
## Order
124140

0 commit comments

Comments
 (0)