-
Notifications
You must be signed in to change notification settings - Fork 378
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
CLOUDFLAREAPI: FEATURE REQUEST: Support Cloudflare Redirects (via Product Rules instead of Page Rules) #2313
Comments
Sounds like a useful thing to support. Can you suggest a name (like CF_BULK_REDIRECT()) and a syntax? |
Haven't experimented with this new functionality yet... (the 3 Pages Rules were exactly enough so far and I have those in my DNSControl config file) |
The bulk redirects are account-wide, not per domain. It seems tricky for dnscontrol to manage them on this basis. (You also need a business or enterprise subscription to use wildcards which makes them a bit limiting). The single redirects look like a useful alternative to page rules here though as they're per domain. You can match on a lot more than source URL though so the syntax would be complicated; you'd need to be able to specify a whole match expression (eg |
I believe the below image is what OP is talking about. These seem to have been intended to supplanted page rules while page rules have retained their ability to do URL redirects. My suggestion, without fully understanding the potential impacts or underlying Cloudflare intentions, is to change both CF_TEMP_REDIRECT("foo.bar.co/*", "https://foofoo.bar.co/", {'cloudflare_ruletype_redirect': 'true'})`
While the new rules have a lot more functionality I don't see any reason why DNSControl needs to make use of any of the additional rule functionality, stick to doing only what it does now. I don't think DNSControl has ever intended to be a complete Cloudflare management system, if a cloudflare user wants more than simple redirects, manage those outside of DNSControl. |
PAGE_RULES are going away: https://developers.cloudflare.com/rules/reference/page-rules-migration/ |
Thank you for notifying! I'm going to convert my three page rules into redirect rules (in the Cloudflare web interface). I will be a bit sad that I lose the "Configuraton-as-Code" that DNSControl provided, so I would like it if my feature request gets implemented at some point, but I would totally understand it if it gets rejected for being outside the scope of DNSControl. |
I use a lot of redirects, so I don't plan on losing this functionality. My plan is to investigate how we could have CF_TEMP_REDIRECT generate the same functionality with the new system. I haven't worked out the details yet, but I hope to start working on this soon. |
@tlimoncelli other kinds of rules are explicitly out of scope? |
@allixsenos I'm not sure. I won't know until I start looking at the code. To be honest, I'm not sure if I'm going to be able to work on this by the time page rules are disabled for free accounts (1-July-2024). If someone else has more time, I'd love help! |
@jzhang-sre and I are working on this now. We hope to ship it in a release in time for people to convert. |
I'm about to merge a PR that supports this. Sadly I'll be on holiday and without computer access between now and when Cloudflare ends support for Free-Tier customers (June 30, 2024). I'd rather get the (potentially buggy) code in people's hands than leave them completely stranded. Hopefully the code will be stable by the time paid customers (July 31, 2024) lose support for Page Rules. |
Finally had time to try this, but all the patterns in my rules are (currently?) not supported?
So they are currently still manual changes in the Cloudflare dashboard, but I hope DNSControl can support these. These are the "When" expression on the dashboard:
And they all have the same "Then" expression:
|
Additionally, I'm getting these errors for domains that don't have any redirects:
|
Would it be an idea to introduce a new
(Handling |
Could you provide the "when" and "then" expressions it should generate? I'll update the code as appropriate. Thanks! |
I already kind of mentioned them in my reply (but the “When” expressions were not completely matching, so I hope I made things consistent here): Rule 1
Rule 2
Rule 3
Observations
|
Thanks for spelling out the 3 cases. I created test cases for all three. Yes, they are similar enough that I was able to cover all 3 with the same if/then. Take a look at #3024 and let me know if that works for you. I'm going to take a stab at |
I fixed @pro-sumer 's bugs and also found many more during deployment at stackoverflow.com. New PR: #3031 A point release will go out tonight. |
Sorry, was too busy to check until now. Seems to work fine with DNSControl version 4.12.1! I don't like the long names, so looking forward to your |
Glad it worked! There will be a 4.12.2 soon to fix one more situation we found. Yes, I don't like the long names either. It was a quick hack to make sure each name was unique. CF_SIMPLE_REDIRECT will let you pick your own name. |
It's great that DNSControl supports redirects via Cloudflare Page Rules using
CF_TEMP_REDIRECT
andCF_REDIRECT
!Unfortunately we only get 3 rules on free plans. Cloudflare recently introduced Redirects via Product Rules (currently in beta) with more relaxed limits.
It would be great if you can support these new redirects as well.
The text was updated successfully, but these errors were encountered: