1. Caddy version (caddy version
):
v2.0.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=
2. How I run Caddy:
Using Docker
FROM caddy:2.0.0
a. System environment:
Docker
b. Command:
Using curl to get a json file stored in my document root
curl -v https://dx.mydomain.org/jsonfile.json
c. Service/unit/compose file:
FROM caddy:2.0.0
COPY Caddyfile /etc/caddy/Caddyfile
COPY index.html /srv/index.html
RUN caddy validate --config /etc/caddy/Caddyfile
d. My complete Caddyfile or JSON config:
dx.mydomain.org {
# Define Customer IP ranges
@memyself {
# Of course not the real IP
remote_ip 146.131.23.0/24
}
# Define actions for customers
handle @memyself {
file_server {
root /var/www
}
}
# Default: Redirect to my Main Page
handle {
redir * https://www.mydomain.org/
}
}
3. The problem I’m having:
I have a json file in UTF-8 on that server which is returned to me like this:
$ curl -v https://dx.mydomain.org/jsonfile.json > x
* Trying 123.123.123.123...
* TCP_NODELAY set
* Connected to dx.mydomain.org (123.123.123.123) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [230 bytes data]
* TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [64 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [2372 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [115 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [37 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
{ [1 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-ECDSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=dx.mydomain.org
* start date: Jul 11 12:15:35 2020 GMT
* expire date: Oct 9 12:15:35 2020 GMT
* subjectAltName: host "dx.mydomain.org" matched cert's "dx.maydomain.org"
* issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7fa67780d800)
> GET /jsonfile.json HTTP/2
> Host: dx.mydomain.org
> User-Agent: curl/7.54.0
> Accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 200
< accept-ranges: bytes
< content-type: application/json
< etag: "qe4ckx4ownr"
< last-modified: Mon, 27 Jul 2020 08:22:09 GMT
< server: Caddy
< content-length: 7880535
< date: Mon, 27 Jul 2020 10:28:54 GMT
<
{ [5886 bytes data]
4. Error messages and/or full log output:
No error message, but I get
content-type: application/json
But would expect
content-type: application/json; charset=UTF-8
5. What I already tried:
Checked issues in the forum and just found some explaining stuff about “mime” which I couldn’t make use of as I did not find any documentation about it. Putting it into the Caddyfile nonetheless resulted in errors:
{"level":"info","ts":1595845120.982867,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
validate: adapting config using caddyfile: /etc/caddy/Caddyfile:12: unrecognized directive: mime