Closed renaudguerin closed 5 years ago
I finally have a workaround : the only thing that worked was adding RUN apk --no-cache add mailcap
to the Dockerfile. This was probably the only difference between my Linux/Docker environment and the Mac one.
Again, forcing the type with the mime
directive was not enough in my case ! Maybe this code path is bypassed when templates
is enabled and it falls back to the default case that relies on a mailcap
file to determine the type ?
I can add mailcap
to the docker image if that fixes it.
I still believe this is a bug, but adding mailcap
is definitely a workaround !
Enabling
templates
for .html (or just with default settings) breaks the mime types of JSON files in the paths it is enabled for. They're all served astext/plain; charset=utf-8
Plot twist : I can't reproduce this with Caddy 1.0.0 on my Mac, I only have this problem with this
abiosoft/caddy-docker
Docker image (so, I don't know if it's a Linux specific problem or due to the way it's built)Repro steps: very simple Caddyfile with
curl -I localhost:2016/
(templated index.html) correctly returnsContent-Type: text/html; charset=utf-8
curl -I localhost:2016/config.json
(plain JSON file) wrongly returnsContent-Type: text/plain; charset=utf-8
What I've tried:
docker build --build-arg plugins="" github.com/abiosoft/caddy-docker.git
and they now both output the exact same version and plugins). Didn't work.mime
directive. Didn't work.templates / .html
and using the long form withpath
/ext
/between
. Didn't work.templates
to a subpath like this :templates /subdir .html
. This works : JSON files outside of that path are now served correctly. But I can't use that because I need my index templated !Any help greatly appreciated !