Issues with cloudflare, specifcally LACK OF DOCS

1. My Caddy version (caddy -version):

2. How I run Caddy:

Please provide all of the relevant information and DO NOT REDACT anything except passwords/keys. Thank you!

a. System environment:

Ubuntu 18.0
Systemd

b. Command:

paste command here

c. Service/unit/compose file:

[Unit]
Description=Caddy's service
ConditionFileIsExecutable=/usr/local/bin/caddy

[Service]
StartLimitInterval=5
StartLimitBurst=10

User=caddyserver
Group=caddyserver


Environment=CLOUDFLARE_EMAIL=email
Environment=CLOUDFLARE_API_KEY=key

ExecStart=/usr/local/bin/caddy "-agree=true" "-conf=/opt/caddy/caddy.conf" "-email=email@email.com"

Restart=always
RestartSec=120

[Install]
WantedBy=multi-user.target

d. My complete Caddyfile:

admin.example.com {

        tls {
                dns cloudflare
        }

        basicauth / user pass
        
        proxy / 192.168.0.1:80

        log /opt/caddy/log/admin.log
}

cdn.example.com {

        tls {
            dns cloudflare
        }

        root /opt/fileserver/workspace
        log /opt/caddy/log/cdn.log
        browse / /opt/caddy/tpl/browse.tpl
}
games.example.com {

        tls {
            dns cloudflare
        }

        basicauth / user pass

        root /opt/games/html
        index index.html
        log /opt/games/log/site.log
        browse / /opt/caddy/tpl/browse.tpl
}

http://192.168.0.101/games_manage {
        log /opt/games/log/manage.log
        webdav / {
             scope       /opt/games/html
             modify      true
         }
}
git.example.com {

        tls {
                dns cloudflare
        }

        proxy / 127.0.0.1:3000 {
        transparent
        }
        log /opt/caddy/log/gitea.log
}

http://codeexample.com, http://private.ip {
        redir https://example.com
}
code.example.com {

        tls {
            dns cloudflare
        }

        basicauth / user pass

        proxy / 192.168.0.115:8080 {
        websocket
        transparent
        }
        log /opt/caddy/log/vscode.log

        proxy /http 192.168.0.115:8081 {
        transparent
        }
}
example.com, www.example.com {

        tls {
            dns cloudflare
        }

        root /opt/caddy/websites/www
        index index.html
        log /opt/caddy/log/www.log
}
zero.example.com {

        tls {
            dns cloudflare
        }

        basicauth / user pass

        header / X-Origin       "127.0.0.1:43110"
        header / X-Host "127.0.0.1:43110"

        proxy / 192.168.0.115:43110 {
                websocket
                header_upstream Head "192.168.0.115:43110"
                header_upstream Origin "192.168.0.115:43110"

        }
        log /opt/caddy/log/zero.log
}

3. The problem I’m having:

THere is basically jack S*** fo rcloudflare dns/tls integration

Nov 15 17:46:01 ubuntu caddy[8144]: 2019/11/15 17:46:01 [WARN] [admin.example.com] acme: error cleaning up: cloudflare: failed to find zone example.com.: ListZonesContext command failed: error from makeRequest: HTTP status 400: content "{\"success\":false,\"errors\":[{\"code\":6003,\"message\":\"Invalid request headers\",\"error_chain\":[{\"code\":6103,\"message\":\"Invalid format for X-Auth-Key header\"}]}],\"messages\":[],\"result\":null}"

4. Error messages and/or full log output:


Nov 15 17:46:01 ubuntu caddy[8144]: 2019/11/15 17:46:01 [WARN] [admin.example.com] acme: error cleaning up: cloudflare: failed to find zone example.com.: ListZonesContext command failed: error from makeRequest: HTTP status 400: content "{\"success\":false,\"errors\":[{\"code\":6003,\"message\":\"Invalid request headers\",\"error_chain\":[{\"code\":6103,\"message\":\"Invalid format for X-Auth-Key header\"}]}],\"messages\":[],\"result\":null}"

5. What I already tried:

trying to find the damned docs

6. Links to relevant resources:

https://go-acme.github.io/lego/dns/cloudflare/

https://caddyserver.com/v1/docs/tls.dns.cloudflare

Hi @Merith-TK,

Apart from the document you already linked (https://caddyserver.com/v1/docs/tls.dns.cloudflare), you should also refer to the Automatic HTTPS documentation, under the DNS Challenge heading:

https://caddyserver.com/v1/docs/automatic-https#dns-challenge

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.