How to disable the HTTP?

1. Caddy version (caddy version):

Caddy 2

2. How I run Caddy:

a. System environment:

Arch Linux

b. Command:

caddy run

d. My complete Caddyfile or JSON config:

https://localhost:1100

tls internal 

encode zstd gzip
file_server {
    root www
}

3. The problem I’m having:

I use Caddy in local to listen HTTPS requests for testing purpose.
I want to disable the HTTP port completely, because I don’t need the HTTP at all.
Also, I can’t run caddy run without sudo because it will need to listen to 80 port when using this my configuration.

4. Error messages and/or full log output:

2020/05/09 14:54:14.218 INFO    using adjacent Caddyfile
2020/05/09 14:54:14.221 INFO    admin   admin endpoint started  {"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["localhost:2019", "[::1]:2019", "127.0.0.1:2019"]}
2020/05/09 22:54:14 [INFO][cache:0xc000636460] Started certificate maintenance routine
2020/05/09 14:54:14.229 INFO    http    enabling automatic HTTP->HTTPS redirects        {"server_name": "srv0"}
run: loading initial config: loading new config: http app module: start: tcp: listening on :80: listen tcp :80: bind: permission denied

5. What I already tried:

I checked some documentation pages, but still don’t know how to disable it.
I know I may (though I haven’t tried) could add a HTTP address in the configuration to solve this problem.
Because I don’t need to use HTTP at all, so I don’t like this workaround.

Thanks in advanced.

Probably the easiest approach would be to use the http_port global option to set the port to something that won’t be as problematic for you.

1 Like

In the automatic_https config for your server, you can disable HTTP redirects: JSON Config Structure - Caddy Documentation

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.