Skip to content

Commit

Permalink
chore: deprecate Gateway.PathPrefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Mar 19, 2021
1 parent 3c81d44 commit 341d2b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmd/ipfs/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,9 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment

// Start assembling node config
ncfg := &core.BuildCfg{
Repo: repo,
Permanent: true, // It is temporary way to signify that node is permanent
Online: !offline,
Repo: repo,
Permanent: true, // It is temporary way to signify that node is permanent
Online: !offline,
DisableEncryptedConnections: unencrypted,
ExtraOpts: map[string]bool{
"pubsub": pubsub,
Expand Down Expand Up @@ -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: https://github.com/ipfs/go-ipfs/issues/7702")
}

node, err := cctx.ConstructNode()
if err != nil {
return nil, fmt.Errorf("serveHTTPGateway: ConstructNode() failed: %s", err)
Expand Down
1 change: 1 addition & 0 deletions core/corehttp/gateway_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 341d2b5

Please sign in to comment.