Skip to content

Commit

Permalink
Merge pull request #451 from ipfs/web-redirects-clarifications
Browse files Browse the repository at this point in the history
web-redirects: clarifications
  • Loading branch information
lidel authored Dec 4, 2023
2 parents 1d52d25 + 8832055 commit f216056
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/http-gateways/web-redirects-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Web _redirects File Specification
description: >
Defines how URL redirects and rewrites can be implemented by adding rules to
a plain text file stored underneath the root CID of a website.
date: 2023-01-28
date: 2023-11-09
maturity: reliable
editors:
- name: Justin Johnson
Expand Down Expand Up @@ -75,7 +75,11 @@ For example:

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

### Splat
Implementation MUST error when the same placeholder name is used more than once in `from`.

Implementation MUST allow the same placeholder name to be used more than once in `to`.

### Catch-All Splat

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.

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

### Comments

Any line beginning with `#` will be treated as a comment and ignored at evaluation time.
Any line beginning with `#` MUST be treated as a comment and ignored at evaluation time.

For example:

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

### Line Termination

Lines MUST be terminated by either `\n` or `\r\n`.
Lines MUST be separated from each other by either `\n` or `\r\n`.

Termination of the last line in the file is optional.

### Whitespace Characters

Blank lines, leading and trailing whitespace characters like `\x20` (space) or
`\t` (tab) MUST be ignored, aside from the line termination mentioned above.

### Max File Size

The file size MUST NOT exceed 64 KiB.

# Evaluation

## Subdomain or DNSLink Gateways
## Same-Origin Requirement

Rules MUST only be evaluated in contexts where
[Same-Origin](https://en.wikipedia.org/wiki/Same-origin_policy) isolation per
root CID is possible.

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.
This requirement is fulfilled on a Subdomain or DNSLink HTTP Gateway,
and also applies to a web browser with native `ipfs://` and `ipns://` scheme handler.

## Order

Expand Down

0 comments on commit f216056

Please sign in to comment.