Closed Klooven closed 2 years ago
Works for me, on Ubuntu 21.04.
$ docker -v
Docker version 20.10.14, build a224086
$ docker compose version
Docker Compose version v2.3.3
Caddyfile:
{
debug
}
:8881 {
respond "ääkkösiä"
}
Run with:
$ docker run --rm -v `pwd`/Caddyfile:/etc/caddy/Caddyfile -p 8881:8881 --name caddy-test caddy:2.5.0-alpine
Test with curl:
$ curl http://localhost:8881
ääkkösiä
Ah, I can replicate in a browser. This isn't an issue with Caddy specifically; since there's no Content-Type
header, the browser will try to guess the encoding, and probably gets it wrong. If you add a header Content-Type "text/plain; charset=UTF-8"
then it works.
{
debug
}
:8881 {
header Content-Type "text/plain; charset=UTF-8"
respond "ääkkösiä"
}
Ooof...
Tried to set the charset header at one point, checked it now and it seems like I misspelled it 🤦♂️ I should maybe take a break 😄
Thanks for the swift response @francislavoie !
I'm running the following simple configuration:
compose.yml
Caddyfile
Environment
The host is running Ubuntu 22.04 LTS
Everything works as expected until this, but when I visit the address I've configured in the Caddyfile, I get the following result:
The result I'm expecting to see is obviously:
I haven't encountered the issue when running Caddy "natively", but with my Docker Compose setups this has always been an issue. When using the
reverse_proxy
directive, however, all content served through Caddy render special characters correctly. The only place that seems to have an issue with them is the Caddyfile.I have yet to determine if this issue originates from the Caddy Docker images or some other part in the process (e.g. the Alpine base image etc.), but I thought that this could be a good place to ask first. I'm happy to share more details if needed, and continue will debugging if anyone has an idea how to resolve the issue.