Hi, quick question, I used caddy before with my local setup (not inside docker) and it worked fine!
Now i am trying to run it via docker but i am getting this error:
GET http://localhost:8888/ui/app NOT FOUND
It seems like it cant find it? Going to / or /hello works correctly and responds correctly. So it seems like an issue in finding the root directory?
I bashed into my container and my frontend files are definitely located at
Hmm, I don’t see anything wrong with that. You are binding port 8888 on the host to 80 on the Caddy container, right?
To debug further, add log to your site block (enables access logs), add the debug global option to the top of your Caddyfile like this:
{
debug
}
And then check the logs with docker logs caddy (or whatever you named the container). Try making the request with curl -v to see the whole response you got.
Thank you for the quick response. For some reason, caddy just doesn’t want to work for me at all inside docker. I even created a very simple Caddyfile:
handle /hello {
respond "hello" 200
}
And it responded with “not found”
It seemed like it was using the old configuration which had this handler:
handle {
respond "not found" 404
}
I then made sure to restart caddy, i even bashed into the container and looked at the caddy configuration file, then i even ran caddy adapt with the config file, still same result of it showing the not found message.
And that is where I just gave up, I couldn’t even make the hello world handler work for some reason.
I switched to traefik and it seemes to work great for me with docker and docker compose.
I have a feeling the problem was in your Dockerfile. You’re trying to do a multi-stage build, right? You did COPY build /srv, but I think you actually need to do COPY --from=build /app/build /srv or something like that (not sure what dir your npm build outputs to, so you’ll need to verify).
If the files aren’t actually in /srv then Caddy’s file_server will serve 404s.