Caddy: How to disable automatic HTTP->HTTPS redirects in Caddy 2?

Created on 31 Jan 2020  路  3Comments  路  Source: caddyserver/caddy

I have another service listening at port 80 and wish to keep Caddy 2 away from port 80 completely.

I did my Caddyfile as such:

caddy.com:443 {
  tls /etc/certs/caddy.crt /etc/certs/caddy.key
  reverse_proxy /caddy 127.0.0.1:8443 {
    transport http {
      tls
    }
  }
}

This did not disable automatic HTTP->HTTPS redirects it seems, the log reads:

INFO    http    enabling automatic HTTP->HTTPS redirects    {"server_name": "srv0"}

How can I keep Caddy 2 away from port 80 completely?

question

Most helpful comment

Will it be possible to do this in a normal Caddyfile in the future?

All 3 comments

Currently you can customize the automatic HTTPS using JSON: https://caddyserver.com/docs/json/apps/http/servers/automatic_https/ -- set the disable_redirects property to true.

Hope that helps!

Will it be possible to do this in a normal Caddyfile in the future?

Was this page helpful?
0 / 5 - 0 ratings