1. My Caddy version (caddy version
):
~ # ./caddy version
v2.0.0-rc.3 h1:z2H/QnaRscip6aZJxwTbghu3zhC88Vo8l/K57WUce4Q=
2. How I run Caddy:
a. System environment:
Ubuntu 18.04
b. Command:
~ # ./caddy run --config caddyconfig.json
c. Service/unit/compose file:
N/A
d. My complete Caddyfile or JSON config:
Retrieved via the /config/
API on a running configuration
{
"admin":{
"enforce_origin":false,
"listen":":2020",
"origins":[
"192.168.10.2:2020"
]
},
"apps":{
"http":{
"servers":{
"srv":{
"automatic_https":{
"skip":[
"jackett.example.eu",
"registry.example.eu"
]
},
"listen":[
":19500"
],
"routes":[
{
"handle":[
{
"handler":"subroute",
"routes":[
{
"handle":[
{
"handler":"reverse_proxy",
"upstreams":[
{
"dial":"http://172.18.0.15:9117"
}
]
}
]
}
]
}
],
"match":[
{
"host":[
"jackett.example.eu"
]
}
],
"terminal":true
},
{
"handle":[
{
"handler":"subroute",
"routes":[
{
"handle":[
{
"handler":"reverse_proxy",
"upstreams":[
{
"dial":"http://172.18.0.23:5000"
}
]
}
]
}
]
}
],
"match":[
{
"host":[
"registry.example.eu"
]
}
],
"terminal":true
}
]
}
}
}
}
}
3. The problem I’m having:
When connecting to one of the defined hosts everything is OK - I receive the expected reply.
When connection as a host which is not defined in caddy, caddy replies with an empty 200
answer:
curl --header "Host: doesnotexist.hello.world" http://192.168.10.2:19500/ -v
* Trying 192.168.10.2...
* TCP_NODELAY set
* Connected to 192.168.10.2 (192.168.10.2) port 19500 (#0)
> GET / HTTP/1.1
> Host: doesnotexist.hello.world
> User-Agent: curl/7.55.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Caddy
< Date: Fri, 24 Apr 2020 11:32:46 GMT
< Content-Length: 0
<
* Connection #0 to host 192.168.10.2 left intact
4. Error messages and/or full log output:
When setting up the log level to DEBUG
, I see correct replies from Caddy when I hoit a defined site, for instance
2020/04/24 11:25:57.816 DEBUG http.handlers.reverse_proxy upstream roundtrip {"upstream": "172.18.0.15:9117", "request": {"method": "GET", "uri": "/", "proto": "HTTP/1.1", "remote_addr": "192.168.10.72:62555", "host": "jackett.example.eu", "headers": {"X-Forwarded-For": ["192.168.10.72"], "User-Agent": ["curl/7.55.1"], "Accept": ["*/*"]}}, "headers": {"Location": ["/UI/Dashboard"], "Date": ["Fri, 24 Apr 2020 11:25:57 GMT"], "Server": ["Kestrel"], "Content-Length": ["0"]}, "duration": 0.001942645, "status": 301}
The status is 301
and it is correct
When I curl
the non-existing site (for instance doesnotexist.hello.world
above) there is no output in the logs (nothing).
Is this a default behaviour? If so, can I change it to something else? (I am actually not sure what the proper return code for “the host is not available here” should be (because it will exist in DNS via a wildcard). Not 200
in any case (I think - because it does not seem right))