Hello,
I’m trying to configure the subdomain gateway
.
I have changed the following in my config file:
"PublicGateways": {
"domain.tld": {
"UseSubdomains": true,
"Paths": ["/ipfs", "/ipns"]
}
},
My public gateway is ipfs.domain.tld
When I open https://docs.ipfs.tech/
in Firefox which has the IPFS companion extension, I get directed to: https://ipfs.domain.tld/ipns/docs.ipfs.tech/
instead of: https://bafybeib4hi7eombqq2ej675e5z2rhzskhgaxl5beq2tgourztauszqfule.ipfs.domain.tld/
(Which works when opened directly)
Does anyone know if this is something I would need to configure in the companion extension, or the cubo config, in order to make the subdomain gateway
work by default?
Relevant reverse proxy config:
ipfs-gateway-router:
rule: HostRegexp(`ipfs.domain.tld`, `{subdomain:[a-z0-9]+}.ipfs.domain.tld`)
entryPoints:
- web-secure
middlewares:
#- local-whitelist
- security-headers
service: ipfs-gateway
tls:
certResolver: le
domains:
- main: "ipfs.domain.tld"
- sans: "*.ipfs.domain.tld"
I have also added a *.ipns.domain.tld
wildcard record in my DNS, and appended the following to the Reverse Proxy configuration:
ipns-gateway-router:
rule: HostRegexp(`ipns.domain.tld`, `{subdomain:[a-z0-9]+}.ipns.domain.tld`)
entryPoints:
- web-secure
middlewares:
#- local-whitelist
- security-headers
service: ipfs-gateway
tls:
certResolver: le
domains:
- main: "ipns.domain.tld"
- sans: "*.ipns.domain.tld"
Still no joy.
What did provide joy though, was changing the hostnames to not include ipfs as the “main” subdomain, and including dashes in the HostRegex.
Final traefik configuration:
ipfs-gateway-router:
rule: Host(`domain.tld`) && PathPrefix(`/ipfs/`, `/ipns/`) || HostRegexp(`{subdomain:[a-z0-9\-]+}.ipfs.domain.tld`)
entryPoints:
- web-secure
middlewares:
#- local-whitelist
- security-headers
service: ipfs-gateway
tls:
certResolver: le
domains:
- main: "ipfs.domain.tld"
- sans: "*.ipfs.domain.tld"
ipns-gateway-router:
rule: Host(`domain.tld`) && PathPrefix(`/ipfs/`, `/ipns/`) || HostRegexp(`{subdomain:[a-z0-9\-]+}.ipns.domain.tld`)
entryPoints:
- web-secure
middlewares:
#- local-whitelist
- security-headers
service: ipfs-gateway
tls:
certResolver: le
domains:
- main: "ipns.domain.tld"
- sans: "*.ipns.domain.tld"
Everything should be working as intended now:
https://domain.tld/ipns/docs.ipfs.tech
→ https://docs-ipfs-tech.ipns.domain.tld
also:
https://domain.tld/ipfs/cid
→ https://cid.domain.tld/