caddy -version):v2.0.0-beta.13 h1:QL0JAepFvLVtOatABqniuDRQ4HmtvWuuSWZW24qVVtk=
./caddy run Caddyfile
Ubuntu 18.04
./caddy run Caddyfile
#
# hass
#
http://hass.lcl.info:9999 {
reverse_proxy / http://172.18.0.5 {
}
}
Caddy tries to start on port 80 despite not having anything to serve on that port.
Alternatively, it may want to start on port 80 to provide a Let's Encrypt challenge endpoint but there are not HTTPS services in the Caddyfile
2020/01/23 13:39:39.260 INFO using adjacent Caddyfile
2020/01/23 13:39:39.262 INFO admin admin endpoint started {"address": "localhost:2019", "enforce_origin": false, "origins": ["localhost:2019"]}
2020/01/23 13:39:39.262 INFO http enabling automatic HTTP->HTTPS redirects {"server_name": "srv0"}
2020/01/23 13:39:39.263 INFO http enabling automatic TLS certificate management {"domains": ["hass.lcl.info"]}
2020/01/23 14:39:39 [INFO][cache:0xc0003b3e00] Started certificate maintenance routine
run: loading initial config: loading new config: http app module: start: tcp: listening on :80: listen tcp :80: bind: address already in use
This appears to be a bug in the Caddyfile adapter: when it calls autoHTTPSHosts(), it gets a list of hostnames from the keys of the site block but the returned list strips the scheme and port information, which is necessary to decide which hostnames should get automatic HTTPS.
Thanks for the information. This means that the port 80 is opened (or attempted to open) for the LE challenge, right?
If this is the case is there a way to open it on another port and have the challenge fail? Would HTTP for the site still be available? Or is it a blocking issue (in the sense that no HTTP sites can be exposed)?
I'm not sure yet, feel free to dive into the code and help debug it :) I'm sick right now so I'm not getting a whole lot of critical thinking done...
Maybe it's not trying to get a cert for the site but is just setting up HTTP->HTTPS redirects when it doesn't need to.
@wsw70 Could you try commit 8b2ad61 which I just pushed? It fixed the issue for me. Please confirm!
@mholt I have not compiled Go programs yet, I will set this up and let you know.
@wsw70 Any update? I will assume this is fixed unless I hear otherwise.
@wsw70 Could you try commit 8b2ad61 which I just pushed? It fixed the issue for me. Please confirm!
Confirmed from my end!
What is the definitive solution for this issue?
I have tried this Caddyfile:
{
auto_https disable_redirects
}
:443 {
tls /etc/caddy/fullchain.pem /etc/caddy/privkey.pem
}
# Other config
... and the following error occur:
{"level":"info","ts":1590408669.3928888,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
run: adapting config using caddyfile: unrecognized parameter name: auto_https
What is the correct configuration to disable the redirect from port 80?
The PR implementing this (#3284) was only merged 6 days ago. It will be part of the next release.
Thanks @Mohammed90.