@cryptotaxi247 / kubo / commits / 2f105f79b

chore: deprecate Gateway.PathPrefixes

Context: https://github.com/ipfs/go-ipfs/issues/7702#issuecomment-803136077

Marcin Rataj committed Mar 20, 2021 at 00:53 UTC 2f105f79b9fc12c4321a2333652ba1a7fb17e936
3 files changed +10
cmd/ipfs/daemon.go
+4
@@ -677,6 +677,10 @@ func serveHTTPGateway(req *cmds.Request, cctx *oldcmds.Context) (<-chan error, e
677 opts = append(opts, corehttp.RedirectOption("", cfg.Gateway.RootRedirect))
678 }
679
680 + if len(cfg.Gateway.PathPrefixes) > 0 {
681 + 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/go-ipfs/issues/7702")
682 + }
683 +
684 node, err := cctx.ConstructNode()
685 if err != nil {
686 return nil, fmt.Errorf("serveHTTPGateway: ConstructNode() failed: %s", err)
core/corehttp/gateway_handler.go
+1
@@ -159,6 +159,7 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
159 // If the gateway is behind a reverse proxy and mounted at a sub-path,
160 // the prefix header can be set to signal this sub-path.
161 // It will be prepended to links in directory listings and the index.html redirect.
162 + // TODO: this feature is deprecated and will be removed (https://github.com/ipfs/go-ipfs/issues/7702)
163 prefix := ""
164 if prfx := r.Header.Get("X-Ipfs-Gateway-Prefix"); len(prfx) > 0 {
165 for _, p := range i.config.PathPrefixes {
docs/config.md
+5
@@ -559,6 +559,9 @@ Type: `bool`
559
560 ### `Gateway.PathPrefixes`
561
562 +**DEPRECATED:** see [go-ipfs#7702](https://github.com/ipfs/go-ipfs/issues/7702)
563 +
564 +<!--
565 Array of acceptable url paths that a client can specify in X-Ipfs-Path-Prefix
566 header.
567
@@ -585,6 +588,8 @@ location /blog/ {
588 }
589 ```
590
591 +-->
592 +
593 Default: `[]`
594
595 Type: `array[string]`