Challenge failed error

1. The problem I’m having:

I got the error challange failed. It seems that is trying to read a local certificate from

challenge failed",“identifier”:“myserver.duckdns.org”,“challenge_type”:“http-01”,“status_code”:400,“problem_type”:“urn:ietf:params:acme:error:connection”,“error”:“95.247.1.148: Fetching http://myserver.duckdns.org/.well-known/acme-challenge/NDUN4nClMgt_G96puCrJY-GBZd2Hgem2LuiYIMaHVJQ: Error getting validation data”}

2. Error messages and/or full log output:

ago 17 16:36:09 webserver caddy[6691]: {"level":"error","ts":1786977369.8510156,"logger":"http.acme_client","msg":"challenge failed","identifier":"myserver.duckdns.org","challenge_type":"http-01","status_code":400,"problem_type":"urn:ietf:params:acme:error:connection","error":"95.247.1.148: Fetching http://myserver.duckdns.org/.well-known/acme-challenge/n09v0Va21tvF_lHvggGfFVkqtFxApMLPtew2kgAm4VM: Error getting validation data"}

3. Caddy version:

2.6.2

4. How I installed and ran Caddy:

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https

curl -1sLf ‘https://dl.cloudsmith.io/public/caddy/stable/gpg.key’ | sudo tee /etc/apt/trusted.gpg.d/caddy-stable.asc

curl -1sLf ‘https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt’ | sudo tee /etc/apt/sources.list.d/caddy-stable.list

sudo apt update

sudo apt install caddy

a. System environment:

Type here

b. Command:

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

c. Service/unit/compose file:

-

d. My complete Caddy config:

# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.
{
http_port 8080
https_port 8443
email davidl@gmail.com
}

:8180 {
        # Set this path to your site's directory.
        root * /usr/share/caddy
        #       auto_https off
        # Enable the static file server.
        file_server

        # Another common task is to set up a reverse proxy:
        # reverse_proxy localhost:8080

        # Or serve a PHP site through php-fpm:
        # php_fastcgi localhost:9000
}

http://myserver.duckdns.org:8080 {
        # Set this path to your site's directory.
        reverse_proxy localhost:8096

        # Enable the static file serve

        # Another common task is to set up a reverse proxy:
        # reverse_proxy localhost:8080

        # Or serve a PHP site through php-fpm:
        # php_fastcgi localhost:9000
}

myserver.duckdns.org {
    respond * "Hello World" 200 {
        close
    }
}


# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile


5. Links to relevant resources:

We the challenge is made on

http://myserver.duckdns.org/.well-known/ac.....

instead of:

http://myserver.duckdns.org:8180/.well-known/ac.....

? How can I change this? I suppose this is the cause of the error…

You can’t. LetsEncrypt needs to verify your web server on the standard port.

However, that’s where Caddy is listening for the challenge anyway so I don’t think that is the problem.