You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: src/http-gateways/web-redirects-file.md
+27-7
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Web _redirects File Specification
3
3
description: >
4
4
Defines how URL redirects and rewrites can be implemented by adding rules to
5
5
a plain text file stored underneath the root CID of a website.
6
-
date: 2023-11-09
6
+
date: 2025-03-19
7
7
maturity: reliable
8
8
editors:
9
9
- name: Justin Johnson
@@ -13,10 +13,9 @@ editors:
13
13
url: https://fission.codes/
14
14
- name: Marcin Rataj
15
15
github: lidel
16
-
url: https://lidel.org/
17
16
affiliation:
18
-
name: Protocol Labs
19
-
url: https://protocol.ai/
17
+
name: Shipyard
18
+
url: https://ipshipyard.com
20
19
tags: ['httpGateways', 'webHttpGateways']
21
20
order: 5
22
21
---
@@ -140,14 +139,24 @@ and also applies to a web browser with native `ipfs://` and `ipns://` scheme han
140
139
141
140
Rules MUST be evaluated in order, redirecting or rewriting using the first matching rule.
142
141
142
+
The non-existent paths that are being requested should be intercepted and redirected to the destination path and the specified HTTP status code returned. The rules are evaluated in the order they appear in the file.
143
+
144
+
Any request for an existing file should be returned as is, and not intercepted by the last catch all rule.
145
+
143
146
## No Forced Redirects
144
147
145
148
All redirect logic MUST only be evaluated if the requested path is not present in the DAG. This means that any performance impact associated with checking for the existence of a `_redirects` file or evaluating redirect rules will only be incurred for non-existent paths.
146
149
147
-
# Error Handling
150
+
##Error Handling
148
151
149
152
If the `_redirects` file exists but there is an error reading or parsing it, the errors MUST be returned to the user with a 500 HTTP status code.
150
153
154
+
## Query Parameters
155
+
156
+
Implementations SHOULD retain any dynamic query parameters supplied by the user and pass them along in the `Location` header of the HTTP redirect response.
157
+
158
+
When merging these user-provided parameters with any static ones defined in the [`To`](#to) field, the user’s dynamic values take precedence, overriding static ones in case of a conflict.
159
+
151
160
# Security
152
161
153
162
This functionality will only be evaluated for Subdomain or DNSLink Gateways, to ensure that redirect paths are relative to the root CID hosted at the specified domain name.
The non-existent paths that are being requested should be intercepted and redirected to the destination path and the specified HTTP status code returned. The rules are evaluated in the order they appear in the file.
217
+
A dedicated test vector with URL query parameter behavior can be found in `bafybeiee3ltldvmfgsxiqazbatrkbvkl34eanbourajwnavhupb64nnbxa`.
218
+
Implementations SHOULD use it for internal testing when [query parameter support](#query-parameters) is desired.
209
219
210
-
Any request for an existing file should be returned as is, and not intercepted by the last catch all rule.
0 commit comments