New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloudflare Redirects #119
Cloudflare Redirects #119
Conversation
if rec.Type == "CF_REDIRECT" || rec.Type == "CF_TEMP_REDIRECT" { | ||
parts := strings.Split(rec.Target, ",") | ||
if len(parts) != 2 { | ||
return fmt.Errorf("Invalid data specified for cloudflare redirect record") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message should mention something about comma being a forbidden char.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, encode the string as follows:
DELIMITER + src + DELIMITER + dst
Set DELIMITER to comma. If comma is in src or dst, try other chars.
I realized something about this. It may potentially break someone who has manually added redirect rules, but has not added the matching I have three options:
|
We should do whatever is the least surprising to users. That removes option 1. Option 2 might be a surprise... and certainly not being able to delete all page rules is a bad thing. How about:
|
Realized this should probably be a provider-level metadata field. Should be something like:
Then all domains on the provider will have redirects managed. If you want to choose on a domain-by-domain basis, maybe need two providers. I think that strikes a pretty good balance between least-surprise and avoiding repetative boilerplate. |
+1 for making it a provider-level metadata field. |
* function sig * sig * some custom record infrastructure * CLOUDFLARE REDIRECTS! * comments out * guarding redirects behind provider metadata to manage * catch commas in js to ensure proper encoding. * gen * small fix * revendor otto * docs
Well this has quite a bit of features:
CF_REDIRECT
andCF_TEMP_REDIRECT
"virtual" record types to DSL.From config:
It runs:
Internally cloudflare provider generates a special record with a specially formatted target, so that it can leverage the common diff algorithm. Output can probably be improved.