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 as
Plot twist : I can’t reproduce this with Caddy 1.0.0 on my Mac, I only have this problem with the popular
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
:2015 templates mime .json application/json
curl -I localhost:2016/(templated index.html) correctly returns
Content-Type: text/html; charset=utf-8
curl -I localhost:2016/config.json(plain JSON file) wrongly returns
Content-Type: text/plain; charset=utf-8
What I’ve tried:
- Rebuilding the Abiosoft container without any plugins, to match the vanilla Caddy I’m using on Mac (they now both output the exact same version and plugins). Didn’t work.
- Forcing/not forcing the type with the
mimedirective. Didn’t work.
- Explicitly setting
templates / .htmland using the long form with
between. Didn’t work.
templatesto 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 !