1. Caddy version (caddy version
):
v2.4.3 h1:Y1FaV2N4WO3rBqxSYA8UZsZTQdN+PwcoOcAiZTM8C0I=
2. How I run Caddy:
Currently using caddy run
or caddy start
a. System environment:
Ubuntu 20.04
b. Command:
sudo caddy run --config ~/temp/Caddyfile
d. My complete Caddyfile or JSON config:
bar.foo.com {
tls admin@foo.com
auto_https off
reverse_proxy localhost:80
}
3. The problem I’m having:
I want to disable automatic HTTPS redirection because my own service is already listening on port 80. I want to use Caddy to provide access to the service using HTTPS.
However, I am unable to edit my Caddyfile to disable HTTPS redirection
4. Error messages and/or full log output:
unrecognized directive: auto_https
5. What I already tried:
Tried using this directive in my Caddyfile
auto_https off
but then we get the error reported above.
If I remove auto_https
directive, I get this other error
2021/07/12 16:22:47.646 INFO admin admin endpoint started {"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["localhost:2019", "[::1]:2019", "127.0.0.1:2019"]}
2021/07/12 16:22:47.647 INFO http server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {"server_name": "srv0", "https_port": 443}
2021/07/12 16:22:47.647 INFO http enabling automatic HTTP->HTTPS redirects {"server_name": "srv0"}
2021/07/12 16:22:47.647 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc000360000"}
2021/07/12 16:22:47.647 INFO tls.cache.maintenance stopped background certificate maintenance {"cache": "0xc000360000"}
run: loading initial config: loading new config: http app module: start: tcp: listening on :80: listen tcp :80: bind: address already in use
Also found that Caddy tries to bind to port 80 if I have in the Caddy file
https://bar.foo.com {
...
or
bar.foo.com:443 {
...