404 on file server

Hi,

1. The problem I’m having:

This should be a very easy one. I have installed Caddy on Windows Server 2025. I am trying to expose a file server and have the following config:

{
    debug
}

http://sonarqube.gssira.com {
    root * C:\acme-challenge
    file_server
}

However, on browsing to this url on my LAN (with DNS setup correctly), I get a 404.

2. Error messages and/or full log output:

Looking at the logs, I see this:

2025/05/19 17:09:18.612 ←[35mDEBUG←[0m  http.log.error  {id=8qur6fibs} fileserver.(*FileServer).notFound (staticfiles.go:705): HTTP 404 {"request": {"remote_ip": "10.1.0.11", "remote_port": "57818", "client_ip": "10.1.0.11", "proto": "HTTP/1.1", "method": "GET", "host": "sonarqube.gssira.com", "uri": "/", "headers": {"Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"], "Accept-Encoding": ["gzip, deflate"], "Accept-Language": ["en-US,en;q=0.9"], "Connection": ["keep-alive"], "Upgrade-Insecure-Requests": ["1"], "User-Agent": ["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0"]}}, "duration": 0.0045838, "status": 404, "err_id": "8qur6fibs", "err_trace": "fileserver.(*FileServer).notFound (staticfiles.go:705)"}

3. Caddy version:

v2.10.0 h1:fonubSaQKF1YANl8TXqGcn4IbIRUDdfAkpcsfI/vX5U=

4. How I installed and ran Caddy:

a. System environment:

Caddy runs as a Windows Server executable on Windows Server 2025 (not configured as a Windows service).

Command

I run:

.\caddy.exe run

HTTP 404 means “file not found.”

What’s in your C:\acme-challenge folder? With your current configuration, Caddy is expecting to find either index.html or index.txt in that folder. If neither is there, it will return a 404 error.

You’ve got a few options:

  • Add the missing index file(s),
  • Update the index directive to match your actual default file, or
  • Enable browse (not recommended unless you know exactly what you’re doing)

More details here:

And you might also want to check out this page:

1 Like

Browse would be fine for this case. I tried:

localhost

file_server browse

But same problem

Ok so I played around and hav this config:

:80

handle_path /.well-known/acme-challenge/* {
    root * C:\acme-challenge
    file_server
}

handle {
    respond "Only ACME challenge files served here." 404
}

Ultimately, all I need to do is serve the test-token file in C:\acme-challenge.well-known\acme-challenge. So whichever way is best to do that?

What acme-challenge files? Caddy will handle all that for you.