Yes, 2.4.3 should have the fix for this. See the release notes:
You can keep an eye on this PR for when it gets merged for the docker official image, then wait an hour or two for the build to happen:
Or you can use the builder image variant and build from source to get it faster if you want. See the section “Adding custom Caddy modules” on Docker Hub, but omit the --with if you don’t have plugins, and use xcaddy build v2.4.3 to build the latest release. The Dockerfile would look like this:
FROM caddy:2.4.2-builder AS builder
RUN xcaddy build v2.4.3
FROM caddy:2.4.2
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
Thanks for the quick response again Francis! I was staring at the release log and wasn’t sure if the problem described was the same as mine. Thanks for the clarification.
To be honest, I’m not certain if it is, because you didn’t provide your full config, but it’s the most likely thing because we know something broke regarding redirects in file_server in v2.4.2.
But yeah – I think the issue is that if your original request didn’t have the / then file_server would only consider the original request path and redirect to add the / even though the path was rewritten to not need it. I’m not sure if your case is the same as the ones that were tested for when implementing the fix, but I think it should be covered.
If you have the time to try building Caddy with the builder docker variant, we’ll know for sure. Should only take a minute or two to try, just use a Dockerfile like this:
FROM caddy:2.4.2-builder AS builder
RUN xcaddy build v2.4.3
FROM caddy:2.4.2
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
If it redirects /project to /project/ I’m totally OK with it.
The main use case for the rewrite is when accessing /project/frontend/route (hence the @spa) I want /project/index.html to be returned.
My local is kinda hard to do this test, it’s quite different how the assets are served. I’ll make sure to report back when I get 2.4.3 up in production. (Yep test in production, I love it)