Can I disable the auto redirect of http to https?

Just use a site block using http:// which will match all hostnames.

http:// {
	respond "No redirect"
}

Since v2.4.0, this will not prevent HTTP->HTTPS redirects for domains explicitly configured in Caddy, but this will prevent HTTP->HTTPS redirects for on-demand domains that Caddy does have certificates for.

In general, to turn off all HTTP->HTTPS redirects, you can use this global option:

{
	auto_https disable_redirects
}
4 Likes