Open j-f1 opened 1 year ago
This is definitely in the right direction.
What do we do if (for example) a DNS provider doesn't support "masked" domains? Should that silently fail or should the provider return an error if it sees any flags/options it doesn't recognize?
I think the answer is that it should error if it sees a flag it doesn't recognize. That way we can even add flags for provider-specific things like CF_REDIRECT().
(Implementation detail: This is easy to implement. We can use the auditrecord.go system, or require the providers to return an error if they don't recognize an option. Option names would be in the form redirect_*
to make it easy to implement.)
Several providers support configuring a domain name to be redirected to another URL:
URL
for temporary redirects andURL301
for permanent ones, plusFRAME
for rendering the site inside of an iframe or similar.CF_REDIRECT
andCF_TEMP_REDIRECT
(docs)URL
URL
URLFWD
.CLOUDNS_WR
which supports 301/302/maskedAs discussed by @tlimoncelli in https://github.com/StackExchange/dnscontrol/issues/1539#issuecomment-1160733399 and https://github.com/StackExchange/dnscontrol/pull/1827#issuecomment-1331417650, this is problematic. Based on my research:
URL
records as 301 (permanent redirects), but Namecheap treats them as temporary.Proposed API:
URL
,URL301
, andFRAME
would be deprecated.CF_REDIRECT
,CF_TEMP_REDIRECT
would remain available with wildcard support.REDIRECT
would work by specifying the source assource + "/*"
and asserting thatdestination
does not include$1
CF_WILDCARD
or similar record option that disables the assert and adding/*
to the source, and the custom record types could be deprecatedNS1_URLFWD
would remain available with wildcard support.REDIRECT
would have similar behavior to Cloudflare, and would use “capture” mode.NS1_WILDCARD
orNS1_URLFWD
as an optionCLOUDNS_WR
would be deprecated, and a newCLOUDNS_SAVE_PATH
/CLOUDNS_NO_SAVE_PATH
could be provided. Additionally, something likeCLOUDNS_REDIRECT()
would enable the record variables (i.e.REDIRECT("www", CLOUDNS_REDIRECT("http://{*domain*}/?ref={*host*}"), TEMPORARY_REDIRECT)
)Some options for how path redirects could be handled: