diff --git a/providers/cloudflare/cloudflareProvider.go b/providers/cloudflare/cloudflareProvider.go index 8cc4ad386..139331385 100644 --- a/providers/cloudflare/cloudflareProvider.go +++ b/providers/cloudflare/cloudflareProvider.go @@ -443,6 +443,13 @@ func checkProxyVal(v string) (string, error) { } func (c *cloudflareProvider) preprocessConfig(dc *models.DomainConfig) error { + + for _, rec := range dc.Records { + if rec.Type == "ALIAS" { + rec.Type = "CNAME" + } + } + // Determine the default proxy setting. var defProxy string var err error @@ -811,6 +818,12 @@ func stringDefault(value interface{}, def string) string { } func (c *cloudflareProvider) nativeToRecord(domain string, cr cloudflare.DNSRecord) (*models.RecordConfig, error) { + + // workaround for https://github.com/StackExchange/dnscontrol/issues/446 + if cr.Type == "SPF" { + cr.Type = "TXT" + } + // normalize cname,mx,ns records with dots to be consistent with our config format. if cr.Type == "ALIAS" || cr.Type == "CNAME" || cr.Type == "MX" || cr.Type == "NS" || cr.Type == "PTR" { if cr.Content != "." { @@ -825,11 +838,6 @@ func (c *cloudflareProvider) nativeToRecord(domain string, cr cloudflare.DNSReco } rc.SetLabelFromFQDN(cr.Name, domain) - // workaround for https://github.com/StackExchange/dnscontrol/issues/446 - if cr.Type == "SPF" { - cr.Type = "TXT" - } - if cr.Type == "A" || cr.Type == "AAAA" || cr.Type == "CNAME" { if cr.Proxied != nil { if *(cr.Proxied) {