Skip to content

Commit

Permalink
feat: sync ipfs gateway config
Browse files Browse the repository at this point in the history
  • Loading branch information
Shawn-Huang-Tron committed May 19, 2023
1 parent a4fd759 commit 62ba092
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions gateway.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package config

const DefaultInlineDNSLink = false

type GatewaySpec struct {
// Paths is explicit list of path prefixes that should be handled by
// this gateway. Example: `["/ipfs", "/ipns", "/api"]`
Expand All @@ -8,7 +10,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 @@ -18,6 +20,11 @@ type GatewaySpec struct {
// NoDNSLink configures this gateway to _not_ resolve DNSLink for the FQDN
// provided in `Host` HTTP header.
NoDNSLink bool

// InlineDNSLink configures this gateway to always inline DNSLink names
// (FQDN) into a single DNS label in order to interop with wildcard TLS certs
// and Origin per CID isolation provided by rules like https://publicsuffix.org
InlineDNSLink Flag
}

// Gateway contains options for the HTTP gateway server.
Expand All @@ -31,29 +38,13 @@ type Gateway struct {
// should be redirected.
RootRedirect string

// Writable enables PUT/POST request handling by this gateway. Usually,
// writing is done through the API, not the gateway.
// REMOVED: modern replacement tracked in https://github.com/ipfs/specs/issues/375
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
PathPrefixes []string

// FIXME: Not yet implemented
// FIXME: Not yet implemented: https://github.com/ipfs/kubo/issues/8059
APICommands []string

// NoFetch configures the gateway to _not_ fetch blocks in response to
Expand All @@ -62,7 +53,7 @@ type Gateway struct {

// NoDNSLink configures the gateway to _not_ perform DNS TXT record
// lookups in response to requests with values in `Host` HTTP header.
// This flag can be overriden per FQDN in PublicGateways.
// This flag can be overridden per FQDN in PublicGateways.
NoDNSLink bool

// PublicGateways configures behavior of known public gateways.
Expand Down

0 comments on commit 62ba092

Please sign in to comment.