From 2f105f79b9fc12c4321a2333652ba1a7fb17e936 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Sat, 20 Mar 2021 00:53:08 +0100 Subject: [PATCH] chore: deprecate Gateway.PathPrefixes Context: https://github.com/ipfs/go-ipfs/issues/7702#issuecomment-803136077 --- cmd/ipfs/daemon.go | 4 ++++ core/corehttp/gateway_handler.go | 1 + docs/config.md | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/cmd/ipfs/daemon.go b/cmd/ipfs/daemon.go index 329a29c4cf4..9a92a0767f1 100644 --- a/cmd/ipfs/daemon.go +++ b/cmd/ipfs/daemon.go @@ -677,6 +677,10 @@ func serveHTTPGateway(req *cmds.Request, cctx *oldcmds.Context) (<-chan error, e opts = append(opts, corehttp.RedirectOption("", cfg.Gateway.RootRedirect)) } + if len(cfg.Gateway.PathPrefixes) > 0 { + 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") + } + node, err := cctx.ConstructNode() if err != nil { return nil, fmt.Errorf("serveHTTPGateway: ConstructNode() failed: %s", err) diff --git a/core/corehttp/gateway_handler.go b/core/corehttp/gateway_handler.go index e4719817418..261c2920f60 100644 --- a/core/corehttp/gateway_handler.go +++ b/core/corehttp/gateway_handler.go @@ -159,6 +159,7 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request // If the gateway is behind a reverse proxy and mounted at a sub-path, // the prefix header can be set to signal this sub-path. // It will be prepended to links in directory listings and the index.html redirect. + // TODO: this feature is deprecated and will be removed (https://github.com/ipfs/go-ipfs/issues/7702) prefix := "" if prfx := r.Header.Get("X-Ipfs-Gateway-Prefix"); len(prfx) > 0 { for _, p := range i.config.PathPrefixes { diff --git a/docs/config.md b/docs/config.md index 3f70795bccb..7760e98d434 100644 --- a/docs/config.md +++ b/docs/config.md @@ -559,6 +559,9 @@ Type: `bool` ### `Gateway.PathPrefixes` +**DEPRECATED:** see [go-ipfs#7702](https://github.com/ipfs/go-ipfs/issues/7702) + + + Default: `[]` Type: `array[string]`