initial ipv6 support
this adds and waits for AAAA records based on setting. we have to wait for both A and AAAA because we don't know if the user is accessing via IPv4 or IPv6. For Let's Encrypt, IPv6 is preferred (but not sure if it retries if IPv6 is unreachable). part of #264
This commit is contained in:
@@ -242,14 +242,27 @@ async function waitForDnsPropagation(app) {
|
||||
return;
|
||||
}
|
||||
|
||||
const ip = await sysinfo.getServerIPv4();
|
||||
const [error] = await safe(dns.waitForDnsRecord(app.location, app.domain, 'A', ip, { times: 240 }));
|
||||
if (error) throw new BoxError(BoxError.DNS_ERROR, `DNS Record is not synced yet: ${error.message}`, { ip: ip, subdomain: app.location, domain: app.domain });
|
||||
const ipv4 = await sysinfo.getServerIPv4();
|
||||
const ipv6Enabled = await settings.getIPv6Config();
|
||||
const ipv6 = ipv6Enabled ? await sysinfo.getServerIPv6() : null;
|
||||
|
||||
let error;
|
||||
[error] = await safe(dns.waitForDnsRecord(app.location, app.domain, 'A', ipv4, { times: 240 }));
|
||||
if (error) throw new BoxError(BoxError.DNS_ERROR, `DNS A Record is not synced yet: ${error.message}`, { ipv4, subdomain: app.location, domain: app.domain });
|
||||
if (ipv6Enabled) {
|
||||
[error] = await safe(dns.waitForDnsRecord(app.location, app.domain, 'AAAA', ipv6, { times: 240 }));
|
||||
if (error) throw new BoxError(BoxError.DNS_ERROR, `DNS AAAA Record is not synced yet: ${error.message}`, { ipv6, subdomain: app.location, domain: app.domain });
|
||||
}
|
||||
|
||||
// now wait for alternateDomains and aliasDomains, if any
|
||||
for (const domain of app.alternateDomains.concat(app.aliasDomains)) {
|
||||
const [error] = await safe(dns.waitForDnsRecord(domain.subdomain, domain.domain, 'A', ip, { times: 240 }));
|
||||
if (error) throw new BoxError(BoxError.DNS_ERROR, `DNS Record is not synced yet: ${error.message}`, { ip: ip, subdomain: domain.subdomain, domain: domain.domain });
|
||||
[error] = await safe(dns.waitForDnsRecord(domain.subdomain, domain.domain, 'A', ipv4, { times: 240 }));
|
||||
if (error) throw new BoxError(BoxError.DNS_ERROR, `DNS A Record is not synced yet: ${error.message}`, { ipv4, subdomain: domain.subdomain, domain: domain.domain });
|
||||
if (ipv6Enabled) {
|
||||
[error] = await safe(dns.waitForDnsRecord(domain.subdomain, domain.domain, 'AAAA', ipv6, { times: 240 }));
|
||||
if (error) throw new BoxError(BoxError.DNS_ERROR, `DNS AAAA Record is not synced yet: ${error.message}`, { ipv6, subdomain: domain.subdomain, domain: domain.domain });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user