dnscontrol
dnscontrol copied to clipboard
Generalize CF_REDIRECT for other providers
I propose to deprecate/remove the CF_
prefix of CF_REDIRECT
and CF_TEMP_REDIRECT
to allow other providers implementing redirects.
While CloudFlare is currently the only provider for those redirect directives, making this a general directive would allow to create something like a nginx
or apache
provider which would generate configuration snippets for the respective webservers.
Some providers support wildcards, others don't. Can you suggest a syntax that would work universally?
Some providers support wildcards, others don't. Can you suggest a syntax that would work universally?
Why would that be an issue? It's REDIRECT(from, to)
and if you use wildcards in from
and the provider of choice doesn't support wildcards, you'll get an error. However, I'd only support a generic match-all wildcard *
, not complex regex patterns.
I see. Yes, the lowest common denominator would be REDIRECT(from, to)
. We'd have to add to the validator code any providers that don't permit wildcards.
Or, we could forbid wildcards since we want REDIRECT() to be fully generic.
Proposal:
- A generic HTTP redirect function called
GENERIC_REDIRECT()
that providers can opt into via Capabilities. -
GENERIC_REDIRECT()
provides a restricted set of features that can be expected on all providers that opt-in. - It should default to 302 (temporary), with a
GENERIC_REDIRECT(from, to, OPT_PERMANENT)
for 301 (Suggestions on a better name?) - Providers should implement a fully-featured redirect named
${PROVIDER}_${VERB}
where$VERB
reflects the feature as $PROVIDER names it. They should then implementGENERIC_REDIRECT()
as a edifice to${PROVIDER}_${VERB}
- Wildcards are not supported. (We could add this in the future)
Thoughts?
I feel like REDIRECT()
plus OPT_*
for new features we add in the future is a good way to go. I also considered using different names instead of options (REDIRECT_301()
, REDIRECT_302()
, REDIRECT_WILDCARD()
, etc.) but my hope is to create one redirect infrastructure that can be extended with OPT_
functions. We can use the AuditRecords()
function to allow providers to reject/accept options.
This is stale. I'm closing this. Please re-open if needed. Thanks!