Skip to content

Commit

Permalink
chore: remove Gateway.PathPrefixes
Browse files Browse the repository at this point in the history
Closes #7702
  • Loading branch information
lidel committed Jul 26, 2022
1 parent 846d362 commit 68c5e26
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 54 deletions.
2 changes: 1 addition & 1 deletion cmd/ipfs/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ func serveHTTPGateway(req *cmds.Request, cctx *oldcmds.Context) (<-chan error, e
}

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/kubo/issues/7702")
log.Fatal("Support for custom Gateway.PathPrefixes was removed: https://github.com/ipfs/go-ipfs/issues/7702")
}

node, err := cctx.ConstructNode()
Expand Down
20 changes: 3 additions & 17 deletions config/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type GatewaySpec struct {
// UseSubdomains indicates whether or not this gateway uses subdomains
// for IPFS resources instead of paths. That is: http://CID.ipfs.GATEWAY/...
//
// If this flag is set, any /ipns/$id and/or /ipfs/$id paths in PathPrefixes
// If this flag is set, any /ipns/$id and/or /ipfs/$id paths in Paths
// will be permanently redirected to http://$id.[ipns|ipfs].$gateway/.
//
// We do not support using both paths and subdomains for a single domain
Expand All @@ -35,22 +35,8 @@ type Gateway struct {
// writing is done through the API, not the gateway.
Writable bool

// PathPrefixes is an array of acceptable url paths that a client can
// specify in X-Ipfs-Path-Prefix header.
//
// The X-Ipfs-Path-Prefix header is used to specify a base path to prepend
// to links in directory listings and for trailing-slash redirects. It is
// intended to be set by a frontend http proxy like nginx.
//
// Example: To mount blog.ipfs.io (a DNSLink site) at ipfs.io/blog
// set PathPrefixes to ["/blog"] and nginx config to translate paths
// and pass Host header (for DNSLink):
// location /blog/ {
// rewrite "^/blog(/.*)$" $1 break;
// proxy_set_header Host blog.ipfs.io;
// proxy_set_header X-Ipfs-Gateway-Prefix /blog;
// proxy_pass http://127.0.0.1:8080;
// }
// PathPrefixes was removed: https://github.com/ipfs/go-ipfs/issues/7702
// TODO: can we remove it from this struct?
PathPrefixes []string

// FastDirIndexThreshold is the maximum number of items in a directory
Expand Down
2 changes: 0 additions & 2 deletions core/corehttp/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
type GatewayConfig struct {
Headers map[string][]string
Writable bool
PathPrefixes []string
FastDirIndexThreshold int
}

Expand Down Expand Up @@ -96,7 +95,6 @@ func GatewayOption(writable bool, paths ...string) ServeOption {
gateway, err = newGatewayHandler(GatewayConfig{
Headers: headers,
Writable: writable,
PathPrefixes: cfg.Gateway.PathPrefixes,
FastDirIndexThreshold: int(cfg.Gateway.FastDirIndexThreshold.WithDefault(100)),
}, api)
if err != nil {
Expand Down
35 changes: 1 addition & 34 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -675,40 +675,7 @@ Type: `bool`

### `Gateway.PathPrefixes`

**DEPRECATED:** see [kubo#7702](https://github.com/ipfs/kubo/issues/7702)

<!--
An array of acceptable url paths that a client can specify in X-Ipfs-Path-Prefix
header.
The X-Ipfs-Path-Prefix header is used to specify a base path to prepend to links
in directory listings and for trailing-slash redirects. It is intended to be set
by a frontend http proxy like nginx.
Example: We mount `blog.ipfs.io` (a dnslink page) at `ipfs.io/blog`.
**.ipfs/config**
```json
"Gateway": {
"PathPrefixes": ["/blog"],
}
```
**nginx_ipfs.conf**
```nginx
location /blog/ {
rewrite "^/blog(/.*)$" $1 break;
proxy_set_header Host blog.ipfs.io;
proxy_set_header X-Ipfs-Gateway-Prefix /blog;
proxy_pass http://127.0.0.1:8080;
}
```
-->

Default: `[]`

Type: `array[string]`
**REMOVED:** see [go-ipfs#7702](https://github.com/ipfs/go-ipfs/issues/7702)

### `Gateway.PublicGateways`

Expand Down

0 comments on commit 68c5e26

Please sign in to comment.