Skip to content

Commit 2f105f7

Browse files
committed
chore: deprecate Gateway.PathPrefixes
Context: #7702 (comment)
1 parent 3c81d44 commit 2f105f7

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

cmd/ipfs/daemon.go

+4
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,10 @@ func serveHTTPGateway(req *cmds.Request, cctx *oldcmds.Context) (<-chan error, e
677677
opts = append(opts, corehttp.RedirectOption("", cfg.Gateway.RootRedirect))
678678
}
679679

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+
680684
node, err := cctx.ConstructNode()
681685
if err != nil {
682686
return nil, fmt.Errorf("serveHTTPGateway: ConstructNode() failed: %s", err)

core/corehttp/gateway_handler.go

+1
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
159159
// If the gateway is behind a reverse proxy and mounted at a sub-path,
160160
// the prefix header can be set to signal this sub-path.
161161
// 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)
162163
prefix := ""
163164
if prfx := r.Header.Get("X-Ipfs-Gateway-Prefix"); len(prfx) > 0 {
164165
for _, p := range i.config.PathPrefixes {

docs/config.md

+5
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,9 @@ Type: `bool`
559559

560560
### `Gateway.PathPrefixes`
561561

562+
**DEPRECATED:** see [go-ipfs#7702](https://github.com/ipfs/go-ipfs/issues/7702)
563+
564+
<!--
562565
Array of acceptable url paths that a client can specify in X-Ipfs-Path-Prefix
563566
header.
564567
@@ -585,6 +588,8 @@ location /blog/ {
585588
}
586589
```
587590
591+
-->
592+
588593
Default: `[]`
589594

590595
Type: `array[string]`

0 commit comments

Comments
 (0)