Cloudflare CNAME automation

Curious if anyone has found a way to automate Cloudflare CNAME records from either docker labels or caddy config. I see there is a traefik-cloudflare-companion app that does this, but I have not come across a solution for caddy.

It’s unclear what you’re asking for here. Why do you need to automate CNAME records?

Please fill out the help topic template, it’s important for us to understand the full context of your question.

Cloudflare does not proxy wildcards so CNAME records must be created to proxy a service. There is a traefik companion app that automates this from docker labels. Hoping to find something similar for Caddy so as to not have to manually manage CNAME records for all of my services.

What in the template would be helpful? Not sure what to show since this functionality does not exist that I am aware of; hence, the question. I also use caddy-docker-proxy which no longer has the ability to show CaddyFile.

It does, it gets output in the logs.

Well, I don’t understand what the shape of your config looks like, so I have to make assumptions based on the very little you’ve said. Showing your config would help me understand what you mean.

I’m still not clear on what you’re expecting to happen.

But I can say pretty confidently nothing like this exists yet, but it might not be too difficult to write a Caddy plugin to do this, using the libdns plugin for Cloudflare. It would be a Caddy app (see the caddy-exec plugin for an example of how a Caddy app is configured via global options).

That is the Caddyfile, just with newlines/tabs encoded in the JSON string. You can toss that text into a tool like Free Online JSON Escape / Unescape Tool - FreeFormatter.com to get it without the escaped newlines etc.

I’d say this is a pretty niche thing to want. Haven’t seen anyone ask for anything similar in the past 1.5 years since Caddy v2 was released.

You’ll probably need to take a shot at writing it yourself.

This topic was automatically closed after 30 days. New replies are no longer allowed.