chore: remove Gateway.PathPrefixes
Closes #7702
Marcin Rataj committed
Apr 22, 2022 at 01:05 UTC
c9693edbc5099f5536da3169dffb52164ab6f850
4 files changed
+4
-54
cmd/ipfs/daemon.go
+1
-1
@@ -812,7 +812,7 @@ func serveHTTPGateway(req *cmds.Request, cctx *oldcmds.Context) (<-chan error, e
812
}
813
814
if len(cfg.Gateway.PathPrefixes) > 0 {
815
- log.Error("Support for X-Ipfs-Gateway-Prefix and Gateway.PathPrefixes is deprecated and will be removed in the next release. Please comment on the issue if you're using this feature: https://github.com/ipfs/kubo/issues/7702")
815
+ log.Fatal("Support for custom Gateway.PathPrefixes was removed: https://github.com/ipfs/go-ipfs/issues/7702")
816
}
817
818
node, err := cctx.ConstructNode()
config/gateway.go
+2
-17
@@ -8,7 +8,7 @@ type GatewaySpec struct {
8
// UseSubdomains indicates whether or not this gateway uses subdomains
9
// for IPFS resources instead of paths. That is: http://CID.ipfs.GATEWAY/...
10
//
11
- // If this flag is set, any /ipns/$id and/or /ipfs/$id paths in PathPrefixes
11
+ // If this flag is set, any /ipns/$id and/or /ipfs/$id paths in Paths
12
// will be permanently redirected to http://$id.[ipns|ipfs].$gateway/.
13
//
14
// We do not support using both paths and subdomains for a single domain
@@ -35,22 +35,7 @@ type Gateway struct {
35
// writing is done through the API, not the gateway.
36
Writable bool
37
38
- // PathPrefixes is an array of acceptable url paths that a client can
39
- // specify in X-Ipfs-Path-Prefix header.
40
- //
41
- // The X-Ipfs-Path-Prefix header is used to specify a base path to prepend
42
- // to links in directory listings and for trailing-slash redirects. It is
43
- // intended to be set by a frontend http proxy like nginx.
44
- //
45
- // Example: To mount blog.ipfs.io (a DNSLink site) at ipfs.io/blog
46
- // set PathPrefixes to ["/blog"] and nginx config to translate paths
47
- // and pass Host header (for DNSLink):
48
- // location /blog/ {
49
- // rewrite "^/blog(/.*)$" $1 break;
50
- // proxy_set_header Host blog.ipfs.io;
51
- // proxy_set_header X-Ipfs-Gateway-Prefix /blog;
52
- // proxy_pass http://127.0.0.1:8080;
53
- // }
38
+ // PathPrefixes was removed: https://github.com/ipfs/go-ipfs/issues/7702
39
PathPrefixes []string
40
41
// FastDirIndexThreshold is the maximum number of items in a directory
core/corehttp/gateway.go
-2
@@ -20,7 +20,6 @@ import (
20
type GatewayConfig struct {
21
Headers map[string][]string
22
Writable bool
23
- PathPrefixes []string
23
FastDirIndexThreshold int
24
}
25
@@ -86,7 +85,6 @@ func GatewayOption(writable bool, paths ...string) ServeOption {
85
gateway := NewGatewayHandler(GatewayConfig{
86
Headers: headers,
87
Writable: writable,
89
- PathPrefixes: cfg.Gateway.PathPrefixes,
88
FastDirIndexThreshold: int(cfg.Gateway.FastDirIndexThreshold.WithDefault(100)),
89
}, api, offlineApi)
90
docs/config.md
+1
-34
@@ -681,40 +681,7 @@ Type: `bool`
681
682
### `Gateway.PathPrefixes`
683
684
-**DEPRECATED:** see [kubo#7702](https://github.com/ipfs/kubo/issues/7702)
685
-
686
-<!--
687
-An array of acceptable url paths that a client can specify in X-Ipfs-Path-Prefix
688
-header.
689
-
690
-The X-Ipfs-Path-Prefix header is used to specify a base path to prepend to links
691
-in directory listings and for trailing-slash redirects. It is intended to be set
692
-by a frontend http proxy like nginx.
693
-
694
-Example: We mount `blog.ipfs.io` (a dnslink page) at `ipfs.io/blog`.
695
-
696
-**.ipfs/config**
697
-```json
698
-"Gateway": {
699
- "PathPrefixes": ["/blog"],
700
-}
701
-```
702
-
703
-**nginx_ipfs.conf**
704
-```nginx
705
-location /blog/ {
706
- rewrite "^/blog(/.*)$" $1 break;
707
- proxy_set_header Host blog.ipfs.io;
708
- proxy_set_header X-Ipfs-Gateway-Prefix /blog;
709
- proxy_pass http://127.0.0.1:8080;
710
-}
711
-```
712
-
713
--->
714
-
715
-Default: `[]`
716
-
717
-Type: `array[string]`
684
+**REMOVED:** see [go-ipfs#7702](https://github.com/ipfs/go-ipfs/issues/7702)
685
686
### `Gateway.PublicGateways`
687