Cloudflare + Caddy + TLS not working

1. The problem I’m having:

Caddy + Cloudflare + TLS not working.

I am trying to setup TLS using caddy on a domain name. The domain name is under cloudflares DNS:

On cloudflares side:

  • DNS only (grey cloud)
  • TLS to ‘Full (strict)’

On my server side I supply the following Caddyfile:

{
    email info@DOMAIN.io
}

DOMAIN.io:443{
    reverse_proxy 127.0.0.1:8888

    log {
        output file /var/log/caddy/DOMAIN.io.log
    }
    handle_errors {
        respond "Something went wrong" 500
    }

}

curl results:

user@machine:~$ curl -IL https://DOMAIN.io/swagger-ui/

*Stays blank*

When I tried the following configuration everything worked fine but no TLS.

{
    email info@DOMAIN.io
    auto_https off
}

DOMAIN.io:80{
    reverse_proxy 127.0.0.1:8888

    log {
        output file /var/log/caddy/DOMAIN.io.log
    }
    handle_errors {
        respond "Something went wrong" 500
    }

}

curl result:

user@machine:~$ curl -IL http://DOMAIN.io/swagger-ui/
HTTP/1.1 200 OK
Content-Length: 734
Content-Type: text/html
Date: Sat, 14 Sep 2024 10:55:29 GMT
Server: Caddy
Connection: close

2. Error messages and/or full log output:

No error messages come in. Only firefox shows: ERR_TIMED_OUT

3. Caddy version:

root@server:~ # caddy version
v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk=

4. How I installed and ran Caddy:

Caddy was installed via the ubuntu install instructions Install — Caddy Documentation

a. System environment:

root@ubuntu-4gb-nbg1-2:~# lsb_release -d
No LSB modules are available.
Description:    Ubuntu 24.04 LTS

root@ubuntu-4gb-nbg1-2:~# uname -a
Linux ubuntu-4gb-nbg1-2 6.8.0-44-generic #44-Ubuntu SMP PREEMPT_DYNAMIC Tue Aug 13 13:35:26 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

b. Command:

systemctl start caddy

d. My complete Caddy config:

{
    email info@DOMAIN.io
}

DOMAIN.io:443 {
    reverse_proxy 127.0.0.1:8888

    log {
            output file /var/log/caddy/a.io.log
    }
    handle_errors {
            respond "Something went wrong" 500
    }
}

I would like to thank anyone in advance for their help and time

WAF blocked port 443 :melting_face:

1 Like

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