mirror of
https://github.com/ipfs/kubo.git
synced 2025-09-10 05:52:20 +08:00
gateway: attempt to resolve hostname to ipfs path
This allows someone to host a static site by pointing a TXT record at their content in IPFS, and a CNAME record at an IPFS gateway. Note that such a setup technically violates RFC1912 (section 2.4; "A CNAME record is not allowed to coexist with any other data."), but tends to work in practice. We may want to consider changing the DNS->IPFS resolution scheme to allow this scenario to be RFC-compliant (e.g. store the mapping on a well-known subdomain to allow CNAME records on the domain itself). License: MIT Signed-off-by: Kevin Wallace <kevin@pentabarf.net>
This commit is contained in:
@ -178,7 +178,10 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
|
||||
|
||||
if gatewayMaddr != nil {
|
||||
go func() {
|
||||
var opts = []corehttp.ServeOption{corehttp.GatewayOption(writable)}
|
||||
var opts = []corehttp.ServeOption{
|
||||
corehttp.IPNSHostnameOption(),
|
||||
corehttp.GatewayOption(writable),
|
||||
}
|
||||
if rootRedirect != nil {
|
||||
opts = append(opts, rootRedirect)
|
||||
}
|
||||
|
Reference in New Issue
Block a user